Yozian.Extension 1.0.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package Yozian.Extension --version 1.0.0
NuGet\Install-Package Yozian.Extension -Version 1.0.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Yozian.Extension" Version="1.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Yozian.Extension --version 1.0.0
#r "nuget: Yozian.Extension, 1.0.0"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Yozian.Extension as a Cake Addin
#addin nuget:?package=Yozian.Extension&version=1.0.0

// Install Yozian.Extension as a Cake Tool
#tool nuget:?package=Yozian.Extension&version=1.0.0

Useful Extension methods

Currently wiki is under working, you could take a look into test project to get examples.

Type Decorated

  • Exception
  • Expression
  • ICollection
  • IDicationary
  • IEnumerable
  • IQueryable
  • Object
  • String

Take IQueryable Extension method as example

conditional query where closure

The example shows the extension method WhereWhen eliminate if statement block.

The constrain applied only when the condition matched, so that you could achieve dynamic query easily!


var books = await this.dbContext.Book
                .Where(x => x.Name.Equals(request.Name))
                .WhereWhen(
                    !string.IsNullOrEmpty(request.Category),
                    x => x.Category.Equals(request.Category)
                )
                .WhereWhen(
                    request.PublishDate.HasValue,
                    x => x.PublishDate.Equals(request.PublishDate)
                )
                .ToListAsync();

for old school way, would have lots of if statement block


var query = this.dbContext.Book
                .Where(x => x.Name.Equals(request.Name));

if(!string.IsNullOrEmpty(request.Category)){
    query = query.Where(x => x.Category.Equals(request.Category))
}

if(request.PublishDate.HasValue){
    query = query.Where(x => x.PublishDate.Equals(request.PublishDate))
}

var books = await query.ToListAsync();


feel free for pull request

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (3)

Showing the top 3 NuGet packages that depend on Yozian.Extension:

Package Downloads
Yozian.DependencyInjectionPlus

Easy for DI register, Auto register services, Decorate service with attribute

Yozian.EFCorePlus

partial updated and scheam description scripts generation

Yozian.Validation

fluent strong type validation

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
2.5.0 118 11/16/2023
2.4.0 2,218 4/16/2022
2.3.0 398 3/25/2022
2.3.0-preview 148 3/25/2022
2.2.7 636 3/30/2021
2.2.6 306 3/22/2021
2.2.4 365 3/11/2021
2.2.2 321 3/11/2021
2.2.2-preview 200 3/11/2021
2.2.1 533 3/8/2020
2.2.0 457 2/6/2020
2.1.3 436 12/22/2019
2.1.1 847 1/21/2019
2.1.0 827 1/16/2019
2.0.1 1,101 1/14/2019
2.0.0 4,740 1/13/2019
1.0.1 808 1/10/2019
1.0.0 1,870 1/9/2019