GenericQueryEngine 1.0.0
dotnet add package GenericQueryEngine --version 1.0.0
NuGet\Install-Package GenericQueryEngine -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="GenericQueryEngine" Version="1.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add GenericQueryEngine --version 1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: GenericQueryEngine, 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 GenericQueryEngine as a Cake Addin #addin nuget:?package=GenericQueryEngine&version=1.0.0 // Install GenericQueryEngine as a Cake Tool #tool nuget:?package=GenericQueryEngine&version=1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
How to Add QueryEngine
To use QueryEngine
in your class, simply inject IQueryEngine
it via the constructor like this:
public class JobService
{
private readonly IQueryEngine _queryEngine;
public JobService(IQueryEngine queryEngine)
{
_queryEngine = queryEngine;
}
}
Example: Executing a Stored Procedure with QueryEngine
To execute a stored procedure using QueryEngine
, follow the example below:
string storedProcedureName = "USP_GetJobLocations";
var jobLocations = await _queryEngine.ExecuteStoredProcedureAsync(
storedProcedureName: storedProcedureName,
parameters: new
{
JobTitle = "Software Engineer",
IsRemote = true,
LocationId = 123,
DatabaseName = "cor_main",
});
Example: Fetching Data with Filters and Aggregates using QueryEngine
To retrieve data from a table with filtering, pagination, order and aggregation, use the GetAsync
method as shown below:
// Define the filters (e.g., filter orders by status and date range)
var filters = new Dictionary<string, (string Operator, object Value)>
{
{ "OrderStatus", ("=", "Completed") },
{ "OrderDate", (">=", DateTime.UtcNow.AddMonths(-3)) }, // Orders from the last 3 months
{ "ProductCategory", ("IN", new[] { "Electronics", "Books" }) }
};
// Define the sorting columns (e.g., sort by OrderDate and CustomerName)
var orderByColumns = new List<string> { "OrderDate", "CustomerName" };
// Define pagination (page 1, 10 results per page)
var pageSize = 10;
var pageNumber = 1;
// Define the aggregate functions (e.g., calculate the total sum of TotalAmount)
var aggregates = new Dictionary<string, string>
{
{ "TotalAmount", "SUM" } // Sum of the TotalAmount column
};
// Call GetAsync with all parameters
var queryResult = await _queryEngine.GetAsync(
tableName: "Orders", // The name of the table we're querying
filters: filters, // Filters to apply
orderByColumns: orderByColumns, // Sorting columns
pageSize: pageSize, // Results per page
pageNumber: pageNumber, // Page number to fetch
aggregates: aggregates // Aggregate functions
);
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0 is compatible. 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. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net8.0
- GenericQueryEngine.DTOs (>= 1.0.0)
- GenericQueryEngine.Repositories (>= 1.0.0)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 9.0.0)
- System.Data.SqlClient (>= 4.9.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 | 98 | 1/1/2025 |