UniversalQueryBuilder.Extensions 10.0.13-beta

This is a prerelease version of UniversalQueryBuilder.Extensions.
dotnet add package UniversalQueryBuilder.Extensions --version 10.0.13-beta
                    
NuGet\Install-Package UniversalQueryBuilder.Extensions -Version 10.0.13-beta
                    
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="UniversalQueryBuilder.Extensions" Version="10.0.13-beta" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="UniversalQueryBuilder.Extensions" Version="10.0.13-beta" />
                    
Directory.Packages.props
<PackageReference Include="UniversalQueryBuilder.Extensions" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add UniversalQueryBuilder.Extensions --version 10.0.13-beta
                    
#r "nuget: UniversalQueryBuilder.Extensions, 10.0.13-beta"
                    
#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.
#:package UniversalQueryBuilder.Extensions@10.0.13-beta
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=UniversalQueryBuilder.Extensions&version=10.0.13-beta&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=UniversalQueryBuilder.Extensions&version=10.0.13-beta&prerelease
                    
Install as a Cake Tool

QueryBuilder.Extensions

Consolidated service registration for Universal Query Builder

QueryBuilder.Extensions provides a single AddQueryBuilder() extension method that registers all Universal Query Builder services with sensible defaults and feature toggles.


Table of Contents


Overview

What is QueryBuilder.Extensions?

QueryBuilder.Extensions consolidates all Universal Query Builder service registration into a single extension method. Instead of calling 9+ separate registration methods in the correct order, call AddQueryBuilder() once with optional configuration.

Before:

// Multiple registration calls in correct order
builder.Services.AddCodeFirstSchemaRegistry(/* ... */);
builder.Services.AddExpressionBuilders();
builder.Services.AddFilterShorthandParser();
builder.Services.AddShorthandFilterApplicator();
builder.Services.AddShorthandQueryTemplates();
builder.Services.AddSchemaRegistry();
// ... more services

After:

// Single method call
builder.Services.AddQueryBuilder(options => { });

What it Includes

The AddQueryBuilder() method registers:

  1. Schema Registry - Code-first data source configuration and discovery
  2. Expression Compilation - Filter expression builder with optional 2-level caching
  3. Shorthand Parser - Human-readable query syntax (is:active AND age>18)
  4. Query Templates - Reusable query shortcuts (optional)
  5. Export Services - Formatting strategy registry

Quick Start

Installation

dotnet add package QueryBuilder.Extensions

Basic Setup

// Register Query Builder with default settings
builder.Services.AddQueryBuilder(options => { });

That's it! All Query Builder services are registered and ready to use.


AddQueryBuilder() API

Minimal Configuration

The simplest configuration uses all defaults:

builder.Services.AddQueryBuilder(options => { });

Defaults:

  • Scans entry assembly for IDataSourceConfiguration<T> implementations
  • Enables shorthand parser
  • Enables query templates
  • Enables 2-level expression caching

Custom Configuration

builder.Services.AddQueryBuilder(options =>
{
    // Scan specific assemblies for data source configurations
    options.ScanAssemblies(typeof(Program).Assembly, typeof(SharedConfigs).Assembly);

    // Configure schema registry conventions
    options.ConfigureSchemaRegistry(schema =>
    {
        schema.DefaultSourceNameCase = SourceNameCase.CamelCase;
        schema.DefaultPropertyNameCase = PropertyNameCase.CamelCase;
    });

    // Configure nested projection options
    options.ConfigureProjections(proj =>
    {
        proj.StrictMode = false;         // Allow unknown fields (log warnings instead of errors)
        proj.MaxCollectionLimit = 500;   // Max items per collection
        proj.MaxNestingDepth = 5;        // Limit nesting depth
    });

    // Disable expression caching for testing
    options.DisableExpressionCaching();
});

Feature Toggles

Turn features on/off with fluent methods:

builder.Services.AddQueryBuilder(options =>
{
    options
        .DisableShorthandParser()    // Skip shorthand syntax support
        .DisableTemplates()           // Skip query template shortcuts
        .DisableExpressionCaching();  // Skip 2-level expression cache
});

When to Disable Features:

  • DisableShorthandParser() - JSON-only APIs, no human-readable queries needed
  • DisableTemplates() - No reusable query shortcuts needed
  • DisableExpressionCaching() - Testing environments, memory-constrained deployments

Assembly Scanning

By default, AddQueryBuilder() scans the entry assembly (the assembly that started the application) for IDataSourceConfiguration<T> implementations. Override with ScanAssemblies():

builder.Services.AddQueryBuilder(options =>
{
    options.ScanAssemblies(
        typeof(Program).Assembly,
        typeof(SharedConfigs).Assembly,
        typeof(PluginModule).Assembly
    );
});

Registration Order

AddQueryBuilder() registers services in this order:

  1. Schema Registry (AddCodeFirstSchemaRegistry) - IHostedService: SchemaRegistryBootstrapper
  2. Expression Compilation (AddExpressionBuilders or AddExpressionCompilation)
  3. Shorthand Parser (AddFilterShorthandParser, AddShorthandFilterApplicator)
  4. Query Templates (AddShorthandQueryTemplates) - IHostedService: TemplateBootstrapper
  5. Export Services (AddSchemaRegistry - FormattingStrategyRegistry only)

Why Order Matters:

  • Schema Registry must run first (IHostedService order)
  • Expression compilation required by shorthand parser
  • Templates require shorthand parser
  • Templates must run after Schema Registry (IHostedService order)

Architecture

QueryBuilderOptions

Fluent builder for configuring Query Builder services:

public class QueryBuilderOptions
{
    public QueryBuilderOptions ScanAssemblies(params Assembly[] assemblies);
    public QueryBuilderOptions ConfigureSchemaRegistry(Action<SchemaRegistryOptions> configure);
    public QueryBuilderOptions ConfigureProjections(Action<NestedProjectionOptions> configure);
    public QueryBuilderOptions DisableShorthandParser();
    public QueryBuilderOptions DisableTemplates();
    public QueryBuilderOptions DisableExpressionCaching();

    internal void Validate();  // Validates configuration (e.g., templates require shorthand)
    internal void Build();     // Registers all services
}

QueryBuilderServiceCollectionExtensions

Provides the single entry point:

public static void AddQueryBuilder(
    this IServiceCollection services,
    Action<QueryBuilderOptions> configure)

  • QueryBuilder.Core - Core models and abstractions
  • QueryBuilder.SchemaRegistry - Code-first data source configuration
  • QueryBuilder.Shorthand - Shorthand query parser
  • QueryBuilder.Expressions - Expression compilation with caching
  • QueryBuilder.EntityFramework - Entity Framework execution strategy
  • QueryBuilder.InMemory - In-memory LINQ execution strategy
Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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
10.0.13-beta 41 6/3/2026
10.0.12-beta 50 6/1/2026
10.0.11-beta 49 5/31/2026
10.0.10-beta 50 5/28/2026
10.0.9-beta 47 5/27/2026
10.0.8-beta 50 5/18/2026
10.0.7-beta 50 5/16/2026
10.0.6-beta 53 5/11/2026
10.0.5-beta 61 4/30/2026
10.0.4-beta 54 4/23/2026
10.0.3-beta 75 4/23/2026
10.0.2-beta 67 4/10/2026
10.0.1-beta 55 4/10/2026
10.0.0-beta 63 4/9/2026