ApiQueryOptions.EntityFrameworkCore 1.0.0-beta5

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

ApiQueryOptions.EntityFrameworkCore

NuGet CI

EF Core companion for ApiQueryOptions.

Translates $expand into .Include() calls and applies the full query pipeline (filter → orderby → skip → top → expand) as a single deferred SQL query. Nothing is enumerated until you call .ToListAsync().


Installation

dotnet add package ApiQueryOptions
dotnet add package ApiQueryOptions.EntityFrameworkCore

Quick start

1. Register in Program.cs

builder.Services.AddControllers();
builder.Services.AddApiQueryOptions();

2. Use the EF Core Apply extension

using ApiQueryOptions.EntityFrameworkCore.Extensions;

[HttpGet]
public async Task<IActionResult> Get(ApiQueryOptions<Order> options)
{
    List<Order> items = await _db.Orders
                                 .Apply(options)        // filter + orderby + skip + top + expand
                                 .AsNoTracking()
                                 .ToListAsync();

    return Ok(new { value = items, nextLink = options.NextLink(items.Count) });
}

3. Request with $expand

GET /api/orders?$filter=Status eq 'Open'&$orderby=CreatedAt desc&$top=20&$expand=Customer,Lines

EF Core eagerly loads the Customer navigation property and Lines collection as part of the same SQL query — no N+1 queries.


What this package adds

Feature ApiQueryOptions This package
$filter → Where() ✔ ✔
$orderby → OrderBy() ✔ ✔
$top → Take() ✔ ✔
$skip → Skip() ✔ ✔
Cursor pagination (NextLink) ✔ ✔
$expand → .Include() ✔
Async .ToListAsync() support ✔

EF Core extensions

using ApiQueryOptions.EntityFrameworkCore.Extensions;

// Full pipeline — filter → orderby → skip → top → expand:
IQueryable<T> result = query.Apply(options);

// Expand only:
IQueryable<T> result = query.ApplyExpand(options.Expand!, options.Settings);

The EF Core Apply runs the core pipeline first, then appends .Include() calls for each path listed in $expand. The whole chain is deferred and translates to a single SQL round-trip.


Nested expand paths

Dot-delimited paths are supported for deep includes:

$expand=Customer,Lines.Product

This generates:

.Include(o => o.Customer)
.Include(o => o.Lines).ThenInclude(l => l.Product)

Supported frameworks

Framework EF Core version
net8.0 8.0.x
net10.0 10.0.x

Source & documentation

Full documentation, runnable examples, and source: github.com/MassiveScale/ApiQueryOptions

Product 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.  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
1.0.0-beta5 931 6/14/2026
1.0.0-beta4 74 6/13/2026
1.0.0-beta3 73 6/12/2026
1.0.0-beta2 68 6/10/2026
1.0.0-beta1 69 6/10/2026