ExpressionBuilderCore 1.0.0
dotnet add package ExpressionBuilderCore --version 1.0.0
NuGet\Install-Package ExpressionBuilderCore -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="ExpressionBuilderCore" Version="1.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add ExpressionBuilderCore --version 1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: ExpressionBuilderCore, 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 ExpressionBuilderCore as a Cake Addin #addin nuget:?package=ExpressionBuilderCore&version=1.0.0 // Install ExpressionBuilderCore as a Cake Tool #tool nuget:?package=ExpressionBuilderCore&version=1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
ExpressionBuilderCore
ExpressionBuilder .net core dll
Original Repo for .net framework Expression Builder https://github.com/tanersenel/ExpressionBuilder
How to use it
Let us imagine we have classes like this...
public enum PersonGender
{
Male,
Female
}
public class Person
{
public int Id { get; set; }
public string Name { get; set; }
public PersonGender Gender { get; set; }
public BirthData Birth { get; set; }
public List<Contact> Contacts { get; private set; }
public Company Employer { get; set; }
public class BirthData
{
public DateTime Date { get; set; }
public string Country { get; set; }
}
public class Company {
public string Name { get; set; }
public string Industry { get; set; }
}
}
public enum ContactType
{
Telephone,
Email
}
public class Contact
{
public ContactType Type { get; set; }
public string Value { get; set; }
public string Comments { get; set; }
}
Now, what about being able query a list of Person
in a way like this:
var filter = new Filter<Person>();
filter.By("Id", Operation.Between, 2, 4, Connector.And);
filter.By("Contacts[Value]", Operation.EndsWith, "@email.com", default(string), Connector.And);
filter.By("Birth.Country", Operation.IsNotNull, default(string), default(string), Connector.Or);
filter.By("Name", Operation.Contains, " John");
var people = People.Where(filter);
//or like this...
var filter = new Filter<Person>();
filter.By("Id", Operation.Between, 2, 4)
.And.By("Birth.Country", Operation.IsNotNull)
.And.By("Contacts[Value]", Operation.EndsWith, "@email.com")
.Or.By("Name", Operation.Contains, " John ");
var people = People.Where(filter);
So that would generate an expression like this:
People.Where(p => (p.Id >= 2 && p.Id <= 4)
&& (p.Birth != null && p.Birth.Country != null)
&& (p.Contacts != null && p.Contacts.Any(c => c.Value.Trim().ToLower().EndsWith("@email.com")))
|| (p.Name != null && p.Name.Trim().ToLower().Contains("john")));
Supported types/operations
The operations are grouped together into logical type groups to simplify the association of a type with an operation:
- Default
- EqualTo
- NotEqualTo
- Text
- Contains
- DoesNotContain
- EndsWith
- EqualTo
- IsEmpty
- IsNotEmpty
- IsNotNull
- IsNotNullNorWhiteSpace
- IsNull
- IsNullOrWhiteSpace
- NotEqualTo
- StartsWith
- Number
- Between
- EqualTo
- GreaterThan
- GreaterThanOrEqualTo
- LessThan
- LessThanOrEqualTo
- NotEqualTo
- Boolean
- EqualTo
- NotEqualTo
- Date
- Between
- EqualTo
- GreaterThan
- GreaterThanOrEqualTo
- LessThan
- LessThanOrEqualTo
- NotEqualTo
Product | Versions 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 | netcoreapp3.0 is compatible. netcoreapp3.1 was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
.NETCoreApp 3.0
- System.Configuration.ConfigurationManager (>= 4.7.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
1.0.0 | 915 | 3/8/2020 |