|
| 1 | +# Infragistics.QueryBuilder.Executor |
| 2 | + |
| 3 | +A .NET 9 library for dynamic, strongly-typed query building and execution over Entity Framework Core data sources. Supports advanced filtering, projection, and SQL generation. |
| 4 | + |
| 5 | +[](https://www.nuget.org/packages/Infragistics.QueryBuilder.Executor/) |
| 6 | + |
| 7 | +--- |
| 8 | + |
| 9 | +## Installation |
| 10 | + |
| 11 | +Install via NuGet Package Manager: |
| 12 | + |
| 13 | +`dotnet add package Infragistics.QueryBuilder.Executor` |
| 14 | + |
| 15 | + |
| 16 | +--- |
| 17 | + |
| 18 | +## Features |
| 19 | + |
| 20 | +- **Dynamic Query Execution**: Compose and execute queries at runtime using a flexible object model. |
| 21 | +- **Advanced Filtering**: Nested filters, logical operators (AND/OR), and rich condition support. |
| 22 | +- **Projection**: Select specific fields or project to DTOs. |
| 23 | +- **SQL Generation**: Generate SQL from the query model for diagnostics or analysis. |
| 24 | +- **ASP.NET Core Integration**: Easily expose query endpoints. |
| 25 | + |
| 26 | +--- |
| 27 | + |
| 28 | +## Getting Started |
| 29 | + |
| 30 | +### 1. Register the QueryBuilder Service |
| 31 | + |
| 32 | +In your `Startup.cs` or Program configuration: |
| 33 | + |
| 34 | +`services.AddQueryBuilder<MyDbContext, MyResultDto>();` |
| 35 | + |
| 36 | + |
| 37 | +### 2. Expose a Query Endpoint |
| 38 | + |
| 39 | +`app.UseEndpoints(endpoints => { endpoints.UseQueryBuilder<MyDbContext, MyResultDto>("/api/query"); });` |
| 40 | + |
| 41 | + |
| 42 | +### 3. Example Query Payload |
| 43 | + |
| 44 | +`{ "Entity": "Users", "ReturnFields": ["Id", "Name"], "Operator": "And", "FilteringOperands": [ { "FieldName": "IsActive", "Condition": { "Name": "equals" }, "SearchVal": true } ] }` |
| 45 | + |
| 46 | + |
| 47 | +### 4. Generate SQL (Optional) |
| 48 | + |
| 49 | +`var sql = SqlGenerator.GenerateSql(query);` |
| 50 | + |
| 51 | + |
| 52 | +--- |
| 53 | + |
| 54 | +## Query Model |
| 55 | + |
| 56 | +- **Query**: Describes the entity, fields, logical operator, and filters. |
| 57 | +- **QueryFilter**: Represents a filter or group of filters. |
| 58 | +- **QueryFilterCondition**: Specifies the comparison type (e.g., equals, contains). |
| 59 | + |
| 60 | +--- |
| 61 | + |
| 62 | +## Dependencies |
| 63 | + |
| 64 | +- .NET 9 |
| 65 | +- Microsoft.EntityFrameworkCore |
| 66 | +- AutoMapper |
| 67 | + |
| 68 | +--- |
| 69 | + |
| 70 | +## License |
| 71 | + |
| 72 | +This package is provided as-is for public and demonstration use. |
| 73 | + |
| 74 | +--- |
| 75 | + |
| 76 | +*For more details, see the source code or contact the maintainers.* |
0 commit comments