NPredicateBuilder 5.1.1
See the version list below for details.
dotnet add package NPredicateBuilder --version 5.1.1
NuGet\Install-Package NPredicateBuilder -Version 5.1.1
<PackageReference Include="NPredicateBuilder" Version="5.1.1" />
paket add NPredicateBuilder --version 5.1.1
#r "nuget: NPredicateBuilder, 5.1.1"
// Install NPredicateBuilder as a Cake Addin #addin nuget:?package=NPredicateBuilder&version=5.1.1 // Install NPredicateBuilder as a Cake Tool #tool nuget:?package=NPredicateBuilder&version=5.1.1
NPredicateBuilder
Simple, testable, LINQ queries.
NPredicateBuilder allows you to build small and easily testable Where and Order clauses that you can chain together to create complex queries.
Quick Overview
class PeopleQuery : BaseQuery<People>
{
public PeopleQuery AndNameIs(string name)
{
AddAndCriteria(x => x.Name == name);
return this;
}
public PeopleQuery OrAgeIsOver(int age)
{
AddOrCriteria(x => x.Age > age);
return this;
}
}
Then create a complex query by chaining them together.
var peopleQuery = new PeopleQuery()
.AndNameIs("brad")
.OrAgeIsOver(10);
Pass your queries and orders to the designated extension method.
var result = ApplicationContext.People
.NPredicateBuilderEFWhere(peopleQuery);
Because it's just an extension method, it behaves like any other LINQ to Object or LINQ to Entities query.
var result = ApplicationContext.People
.NPredicateBuilderEFWhere(peopleQuery)
.Skip(10)
.Take(15)
.Select(x => new { x.Name, x.Age })
.ToList();
NPredicateBuilder can easily be added to any existing or new codebase, no matter what size!
NPredicateBuilder can simplify Ordering in the same way it handles Queries.
Install NPredicateBuilder
The best way is to install with NuGet.
In your domain layer.
Install-Package NPredicateBuilder
If you are doing LINQ to Entities, install the following in your data access layer.
Install-Package NPredicateBuilder.EF
Documentation
Any and all documentation can be viewed in the wiki.
It's only a five minute read!
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 is compatible. net5.0-windows was computed. net6.0 is compatible. 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 is compatible. 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 is compatible. |
.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. |
-
.NETStandard 2.0
- No dependencies.
-
.NETStandard 2.1
- No dependencies.
-
net5.0
- No dependencies.
-
net6.0
- No dependencies.
-
net7.0
- No dependencies.
NuGet packages (1)
Showing the top 1 NuGet packages that depend on NPredicateBuilder:
Package | Downloads |
---|---|
NPredicateBuilder.EF
NPredicateBuilder extensions for Entity Framework. |
GitHub repositories
This package is not used by any popular GitHub repositories.