NetQueryBuilder 1.0.0

dotnet add package NetQueryBuilder --version 1.0.0
                    
NuGet\Install-Package NetQueryBuilder -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="NetQueryBuilder" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="NetQueryBuilder" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="NetQueryBuilder" />
                    
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 NetQueryBuilder --version 1.0.0
                    
#r "nuget: NetQueryBuilder, 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.
#:package NetQueryBuilder@1.0.0
                    
#: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=NetQueryBuilder&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=NetQueryBuilder&version=1.0.0
                    
Install as a Cake Tool

NetQueryBuilder

NetQueryBuilder is a flexible .NET library for building dynamic IQueryable-based queries, providing a solid foundation for various data source implementations.

License

Important: Net Query Builder is open-source under the MIT license for personal, educational, and non-commercial use. For commercial use, a valid commercial license must be purchased from https://huline.gumroad.com/l/netquerybuilder. See LICENSE for more details.

Description

The core package of NetQueryBuilder provides an extensible architecture for building dynamic queries in .NET. Designed around the IQueryable interface, it enables the creation of typed query conditions and complex expressions without depending on any specific ORM.

While this package can be used independently, it's primarily designed as a foundation for custom implementations or extension packages like NetQueryBuilder.EntityFramework.

Key Features

  • IQueryable-based query construction, ORM-independent
  • Extensible architecture allowing advanced customization
  • Configurable operator system (Equals, Like, GreaterThan, etc.)
  • Dynamic condition expressions with support for complex property paths
  • Clear interfaces for extension and customization

Installation

dotnet add package NetQueryBuilder

Core Components

IQueryConfigurator

The IQueryConfigurator interface is the main entry point for configuring and building queries:

public interface IQueryConfigurator
{
    IEnumerable<Type> GetEntities();
    IQueryConfigurator UseExpressionStringifier(IExpressionStringifier expressionStringifier);
    IQueryConfigurator ConfigureSelect(Action<ISelectConfigurator> selectBuilder);
    IQueryConfigurator ConfigureConditions(Action<IConditionConfigurator> selectBuilder);
    IQuery BuildFor<T>() where T : class;
    IQuery BuildFor(Type type);
}

Basic Query Creation

// Create a custom instance of IQueryConfigurator
IQueryConfigurator queryConfigurator = new QueryableQueryConfigurator();

// Build a query for a specific type
IQuery query = queryConfigurator.BuildFor<YourEntityType>();

// Execute the query
var results = await query.Execute(50);

Custom Operators

NetQueryBuilder allows you to define custom operators for specific needs:

// Create a custom operator
public class CustomOperator : OperatorBase
{
    public override string Symbol => "CustomOp";

    public override Expression BuildExpression(Expression left, Expression right)
    {
        // Custom logic to build an expression
        return Expression.Call(
            typeof(CustomMethods).GetMethod("YourCustomMethod"),
            left,
            right
        );
    }
}

Condition Configuration

// Manual condition configuration
queryConfigurator.ConfigureConditions(config => {
    // Additional configuration
});

// Create a condition in a query
var query = queryConfigurator.BuildFor<YourEntityType>();
var property = query.ConditionPropertyPaths.First(p => p.PropertyFullName == "YourProperty");
query.Condition.CreateNew(property, new CustomOperator(), yourValue);

Extending with Your Own Data Sources

To integrate NetQueryBuilder with your own data source or ORM, you need to implement the key interfaces:

// Custom query configurator implementation
public class CustomQueryConfigurator : IQueryConfigurator
{
    public IQuery BuildFor<T>() where T : class
    {
        // Your implementation to create a query
        return new CustomQuery<T>();
    }
    
    // Other method implementations
}

// Custom query implementation
public class CustomQuery<T> : IQuery where T : class
{
    public async Task<IEnumerable<object>> Execute()
    {
        // Your logic to execute the query on your data source
        // Transform your condition criteria into appropriate query for your ORM/source
    }
    
    // Other method implementations
}

Available Implementations

While the core package can be used on its own, NetQueryBuilder also offers specific implementations:

  • NetQueryBuilder.EntityFramework: Integration with Entity Framework Core
  • NetQueryBuilder.Blazor: UI components for Blazor

Customization Use Cases

NetQueryBuilder core is particularly useful in the following scenarios:

  • Integration with ORMs not officially supported
  • Creating queries for REST APIs or NoSQL data sources
  • Implementing domain-specific filtering logic
  • Creating DSLs (Domain-Specific Languages) for queries
  • Use in environments where Entity Framework is not available or desired

Contribution

Contributions are welcome! You can contribute by implementing adapters for other ORMs or by improving the features of the core package.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  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 is compatible.  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.  net10.0 was computed.  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. 
.NET Core netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.1 is compatible. 
.NET Framework net48 is compatible.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (3)

Showing the top 3 NuGet packages that depend on NetQueryBuilder:

Package Downloads
NetQueryBuilder.EntityFramework

Entity Framework Core integration for NetQueryBuilder - Enables dynamic query execution against EF Core DbContext with full support for navigation properties and relationships

NetQueryBuilder.Blazor

Blazor UI components for NetQueryBuilder - Build dynamic queries with MudBlazor-based visual interface including query builder, condition editor, and result tables

NetQueryBuilder.AspNetCore

ASP.NET Core Razor Pages integration for NetQueryBuilder - Tag Helpers, View Components, and base page models for server-side dynamic query building without JavaScript

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.0 125 1/19/2026