.NET CLI
dotnet add package ServiceQuery

Getting started
Install ServiceQuery®, build a structured request, execute it over the queryable source your API owns, and expose the result through an endpoint you control.
Flexible queries. Deliberate boundaries.
Install the foundation
Choose the installation path that fits your .NET workflow, then continue to the request model.
dotnet add package ServiceQuery
Install-Package ServiceQuery
<PackageReference Include="ServiceQuery" />
Provider-Specific Installation
The default ServiceQuery® library provides synchronous support. Add a provider-specific package when your data source needs additional integration or asynchronous execution.
ServiceQueryThe default library provides synchronous query support.
ServiceQuery.AzureDataTablesProvides support for Azure storage accounts and their data tables.
ServiceQuery.EntityFrameworkCoreProvides async support. Note: .NET Core 8 uses the EFC 9 package.
ServiceQuery.EntityFrameworkCore8Provides async support for .NET Core 8 using EFC 8. This custom package exists because of the EFC 8 and EFC 9 distinction.
ServiceQuery.MongoDbProvides synchronous and asynchronous support for MongoDB databases.
Build the request
The fluent builder adds ordered filters and operations to a ServiceQueryRequest. Build only the operations your API has decided to expose.
using ServiceQuery;
var request = new ServiceQueryRequestBuilder()
.IsEqual("Status", "Active")
.SortDesc("CreatedAt")
.Paging(1, 25, true)
.Build();
The builder creates the request model. The API still decides whether the requested fields, operations, scope, and limits are valid.
Execute against your source
ServiceQuery® executes the structured request over the IQueryable source selected by the API. Provider translation and supported expression behavior remain contextual.
var queryable = databaseContext.Products
.AsQueryable();
var response = request.Execute(queryable);
var queryable = databaseContext.Products
.AsQueryable();
var responseAsync = await request
.ExecuteAsync(queryable);
Put it behind an API boundary
A dynamic request does not replace authentication, authorization, tenant scope, field policy, or operational limits. Establish those boundaries before execution. The examples below abbreviate how authenticated tenant context is resolved.
Minimal API boundary (abbreviated)
app.MapPost("/products/query",
(ServiceQueryRequest request, AppDb db) =>
{
// tenantId comes from authenticated request context.
var scopedProducts = db.Products
.Where(product => product.TenantId == tenantId)
.Where(product => !product.IsDeleted);
return Results.Ok(request.Execute(scopedProducts));
});
Controller boundary (abbreviated)
[HttpPost("query")]
public ServiceQueryResponse<Product> Query(
ServiceQueryRequest request)
{
var scopedProducts = _db.Products
.Where(product => product.TenantId == _tenantId);
return request.Execute(scopedProducts);
}
Use the same model from JavaScript
The JavaScript builder produces the same request shape for an HTTP endpoint. Keep the server as the authority over what that request may do.
const request = new ServiceQueryRequestBuilder()
.IsEqual("Status", "Active")
.SortDesc("CreatedAt")
.Paging(1, 25, true)
.Build();
fetch('/api/products/query', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(request)
});
Inspect. Run. Adopt.
Review the operation surface, run a real request, and apply the pattern where structured querying helps the API you already have.