A .NET library that provides utilities for handling query requests with dynamic filters, expansions, and projections for Entity Framework Core applications. This library enables type-safe, expression-based querying with support for both generic and non-generic scenarios, making it ideal for building flexible data access layers in enterprise applications.
- Dynamic Query Building: Construct complex LINQ queries using expression descriptors
- Type-Safe Operations: Generic methods ensure compile-time type safety while supporting runtime type resolution
- Filter & Select Operations: Build and execute filtered queries with custom select projections
- Expand/Include Support: Dynamically include related entities using SelectExpandDefinition
- Anonymous Type Support: Query and return dynamic/anonymous types for flexible data transfer objects
- Entity Retrieval: Retrieve single entities with filtering and expansion capabilities
- List Queries: Execute queries that return collections with flexible return types (IEnumerable, IQueryable, etc.)
- Delete Operations: Execute delete operations using dynamic filter expressions
- Persistence Operations: Synchronous wrappers for common Entity Framework Core CRUD operations
- Entity Framework Core: Built on top of Entity Framework Core for robust data access
The main interface providing three primary operations:
- GetEntity: Retrieve a single entity based on a filter expression
- GetList: Retrieve a typed list of entities with custom projections
- GetAnonymousList: Retrieve a list of dynamic objects for anonymous type projections
Each method supports both generic and non-generic overloads for maximum flexibility.
Provides delete operations using parameter-based filter expressions:
- Delete<TModel, TData>: Delete entities matching a FilterLambdaOperatorParameters expression
Provides entity retrieval with filtering, querying, and expansion support:
- Get<TModel, TData>: Retrieve a single entity with optional filtering, query functions, and expansion
- GetItems<TModel, TData>: Retrieve a collection of entities with optional filtering, query functions, and expansion
Provides advanced query operations with flexible return types:
- Query<TModel, TData, TModelReturn, TDataReturn>: Execute custom LINQ queries with mapping between model and data types
Provides synchronous wrappers for Entity Framework Core persistence operations:
- AddChange: Add or update a single entity
- AddChanges: Add or update multiple entities
- AddGraphChange: Add or update an entity graph (with related entities)
- AddGraphChanges: Add or update multiple entity graphs
- Delete: Delete entities matching a filter expression
- Save: Save a single entity
- SaveList: Save multiple entities
- SaveGraph: Save an entity graph
- SaveGraphs: Save multiple entity graphs
Static wrapper for delete operations:
- Delete: Execute delete operations using FilterLambdaOperatorParameters
Static wrappers for projection operations:
- Get (GetSingle): Retrieve a single entity synchronously
- GetItems (GetList): Retrieve a collection of entities synchronously
Static wrapper for query operations:
- Query: Execute custom queries with flexible return types synchronously
All static operation classes use the [AlsoKnownAs] and [FunctionGroup] attributes for integration with the LogicBuilder framework, enabling these methods to be called from business rules and workflows.
- GetEntityRequest: Defines entity retrieval with filter and optional select/expand definitions
- GetTypedListRequest: Defines list queries with selector expressions and optional expansions
- GetObjectListRequest: Defines queries returning dynamic/anonymous objects
- GetEntityResponse: Contains the retrieved entity and success status
- GetListResponse: Contains the retrieved list and success status
- GetObjectListResponse: Contains dynamic objects and success status
- Building flexible Web APIs with OData-like query capabilities
- Implementing repository patterns with dynamic query construction
- Creating data access layers that support runtime type resolution
- Developing business logic layers that require expression-based filtering and projection
- Building applications that need to query data using externally-defined expression descriptors
- Executing persistence operations (CRUD) with type-safe generic methods
- Integrating data operations with rule-based business logic systems
- Performing complex entity graph operations (saving entities with related data)
- LogicBuilder.App.Bsl.Business: Business layer components for requests and responses
- LogicBuilder.App.Common.Utils: Common utilities for mapping operations
- LogicBuilder.EntityFrameworkCore: EF Core extensions and repository patterns
- LogicBuilder.Attributes: Attributes for function metadata and framework integration
- .NET 10.0: Built for the latest .NET platform
The library handles complex scenarios such as:
- Querying departments with related courses using expand definitions
- Selecting and projecting entities to different model types (e.g., Department → LookUpsModel)
- Ordering, filtering, and limiting results dynamically
- Grouping data with aggregations (e.g., group students by enrollment date with counts)
- Type-safe mapping between entity types and model types using expression descriptors
- Deleting entities based on dynamic filter expressions
- Saving entity graphs with related entities in a single operation
- Executing synchronous CRUD operations from business rules
- .NET 10.0
MIT License - Copyright © BPS 2026
https://github.com/BpsLogicBuilder/LogicBuilder.App.Bsl.Utils