You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1.7 KiB
1.7 KiB
LINGYUN.Linq.Dynamic.Queryable
A basic library for dynamic querying, extending Linq to dynamically build expression trees.
Features
- Support for dynamic query condition building
- Support for various comparison operators: equal, not equal, greater than, less than, greater than or equal, less than or equal, contains, not contains, starts with, not starts with, ends with, not ends with, etc.
- Support for dynamic type conversion and null value handling
- Support for dynamic querying of enum types
Configuration and Usage
The module can be referenced as needed, providing extensions only for Linq.
Basic Usage
// Create dynamic query parameter
var parameter = new DynamicParamter
{
Field = "Name",
Comparison = DynamicComparison.Equal,
Value = "test"
};
// Create query condition
var queryable = new DynamicQueryable
{
Paramters = new List<DynamicParamter> { parameter }
};
// Apply to Expression
Expression<Func<TEntity, bool>> condition = e => true;
condition = condition.DynamicQuery(queryable);
// Query using the condition
var result = await repository.Where(condition).ToListAsync();
Supported Comparison Operators
Equal- EqualsNotEqual- Not equalsLessThan- Less thanLessThanOrEqual- Less than or equal toGreaterThan- Greater thanGreaterThanOrEqual- Greater than or equal toContains- ContainsNotContains- Does not containStartsWith- Starts withNotStartsWith- Does not start withEndsWith- Ends withNotEndsWith- Does not end with