A comprehensive metadata library for building dynamic LINQ expressions through descriptors. This library provides a rich set of classes that represent expression components, enabling the construction of complex LINQ queries from serializable metadata structures.
LogicBuilder.Structures serves as the metadata foundation for the LogicBuilder.Expressions framework. Instead of writing LINQ expressions directly in code, developers can:
- Define expressions as metadata using descriptor classes
- Serialize and store query definitions independent of code
- Dynamically build LINQ Expression Trees at runtime
- Support data-driven query scenarios where query logic comes from configuration or user input
- Binary Operations:
EqualsBinaryDescriptor,GreaterThanBinaryDescriptor,LessThanBinaryDescriptor, etc. - Logical Operations:
AndBinaryDescriptor,OrBinaryDescriptor,NotDescriptor - Arithmetic Operations:
AddBinaryDescriptor,SubtractBinaryDescriptor,MultiplyBinaryDescriptor,DivideBinaryDescriptor,ModuloBinaryDescriptor
- Filtering:
WhereDescriptor,AnyDescriptor,AllDescriptor - Projection:
SelectDescriptor,SelectManyDescriptor - Ordering:
OrderByDescriptor,ThenByDescriptor - Aggregation:
CountDescriptor,SumDescriptor,AverageDescriptor,MinDescriptor,MaxDescriptor - Paging:
SkipDescriptor,TakeDescriptor - Grouping:
GroupByDescriptor - Element Access:
FirstDescriptor,LastDescriptor,SingleDescriptor, and theirOrDefaultvariants
- Set Operations:
UnionDescriptor,ConcatDescriptor,ExceptDescriptor - Collection Tests:
AnyDescriptor,AllDescriptor,ContainsDescriptor
SubstringDescriptor,ContainsDescriptor,StartsWithDescriptor,EndsWithDescriptorToUpperDescriptor,ToLowerDescriptor,TrimDescriptorLengthDescriptor,IndexOfDescriptor,ConcatDescriptor
- Component extraction:
YearDescriptor,MonthDescriptor,DayDescriptor,HourDescriptor,MinuteDescriptor,SecondDescriptor - Conversions:
ConvertToNumericDateDescriptor,ConvertToNumericTimeDescriptor - Fractional seconds:
FractionalSecondsDescriptor
FloorDescriptor,CeilingDescriptor,RoundDescriptor
- Casting:
CastDescriptor,ConvertDescriptor,CollectionCastDescriptor,CollectionOfTypeDescriptor - Type Checking:
IsOfDescriptor - Conversions:
ConvertToStringDescriptor,ConvertToEnumDescriptor,ConvertToNullableUnderlyingValueDescriptor
MemberSelectorDescriptor- Access properties and fieldsParameterDescriptor- Define lambda parametersConstantDescriptor- Represent constant valuesCollectionConstantDescriptor- Represent collection constants
CustomMethodDescriptor- Call custom methods on typesMemberInitDescriptor- Initialize anonymous types or objects
Works seamlessly with LogicBuilder.Expressions.Utils to:
- Map descriptors to LINQ Expression Trees via AutoMapper
- Execute dynamic queries against Entity Framework, LINQ to Objects, and other LINQ providers
- Build complex filtering, sorting, paging, and aggregation logic from configuration
- OData-style filtering with complex predicates
- Dynamic reporting queries with runtime-defined aggregations
- Configurable business rules expressed as queryable filters
- User-defined search criteria converted to type-safe LINQ expressions
- Multi-tenant filtering applied dynamically based on context
- Serializable: All descriptors are POCOs that can be JSON/XML serialized
- Type-safe: Generates strongly-typed LINQ expressions at runtime
- Testable: Expression logic can be unit tested through descriptors
- Maintainable: Query logic separated from code into data structures
- Extensible: Custom descriptors can be added for domain-specific needs
- LogicBuilder.Expressions.Utils: Descriptors can be converted to their corresponding operators which generate executable LINQ expressions
- LogicBuilder.EntityFrameworkCore.SqlServer: Entity Framework integration and testing