DataMagic.Apis.Abstractions 9.0.0

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

DataMagic.Apis.Abstractions

DataMagic.Apis.Abstractions is a small .NET 9 library that connects DataMagic.Abstractions to ASP.NET Core APIs. It currently contains PagerDto, which binds a pager from the query string in minimal API endpoints.

Installation

dotnet add package DataMagic.Apis.Abstractions

This also installs DataMagic.Abstractions.

Contents

Namespace Contains
DataMagic.Apis.Abstractions.Dtos PagerDto

PagerDto

PagerDto implements IPager and wraps one of the pagers from DataMagic.Abstractions. Declare it as an endpoint parameter, and minimal APIs build it from the query string through its BindAsync method.

using DataMagic.Abstractions.Interfaces;
using DataMagic.Abstractions.Models.Pagers;
using DataMagic.Apis.Abstractions.Dtos;

app.MapGet("/products", async (PagerDto? pager, ProductService service) =>
{
    IPager actualPager = pager ?? new DefaultPager(1, 20);
    return await service.SearchAsync(actualPager);
});

Query string

The pager kind decides which other values are read. Each value can be sent with or without the pager[...] prefix. The prefixed form wins when both are present.

Kind Query string Pager created
default ?pager[kind]=default&pager[page]=2&pager[totalRecords]=20 DefaultPager(2, 20)
skipLimit ?kind=skipLimit&skippedRecords=40&totalRecords=20 SkipLimitPager(40, 20)

The kind is matched case-insensitively.

Value Default when missing or not a number
page 1
skippedRecords 0
totalRecords 10

Behaviour to know about

  • Binding returns null when kind is missing or is not default or skipLimit. index is not supported. Declare the parameter as PagerDto? and fall back to a pager of your own, as in the example above. A non-nullable PagerDto parameter makes the request fail with 400 Bad Request instead.
  • Out-of-range numbers, such as page=0, make the pager constructor throw ArgumentException, which is not caught during binding.
  • TryParse ignores its input and always returns DefaultPager(1, 10). Minimal APIs use BindAsync first, so this only matters if you call TryParse yourself or bind it with an attribute such as [FromQuery].

Getting the underlying pager

GetUnderlyingPager() returns the wrapped IPager. PagerDto also converts implicitly to DefaultPager and SkipLimitPager. The conversion gives null when the wrapped pager is of the other kind.

using DataMagic.Abstractions.Models.Pagers;

DefaultPager? defaultPager = pager;
SkipLimitPager? skipLimitPager = pager;
Product Compatible and additional computed target framework versions.
.NET 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on DataMagic.Apis.Abstractions:

Package Downloads
ApiFeatures.FileWatchers.Apis

Package Description

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
9.0.0 114 11/2/2026
1.0.1 80 11/2/2026
1.0.0 519 2/8/2026