DevInstance.WebServiceToolkit.Common 10.0.1

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

DevInstance.WebServiceToolkit.Common

Common models and attributes for WebServiceToolkit with no ASP.NET Core dependency.

Installation

dotnet add package DevInstance.WebServiceToolkit.Common

Features

This package provides:

  • Model classes for API responses (ModelItem, ModelList<T>)
  • Query model attributes for parameter binding ([QueryModel], [QueryName])
  • Utility methods for creating model responses

API Reference

ModelItem

Base class for entities with a server-assigned unique identifier.

public class Product : ModelItem
{
    public string Name { get; set; }
    public decimal Price { get; set; }
}

// The Id property is inherited from ModelItem
var product = new Product { Id = "abc123", Name = "Widget", Price = 9.99m };

ModelList<T>

Paginated response wrapper with sorting and search metadata.

var response = new ModelList<Product>
{
    Items = products.ToArray(),
    TotalCount = 150,
    PagesCount = 8,
    Page = 0,
    Count = 20,
    SortBy = "Name",
    IsAsc = true,
    Search = "widget"
};

Properties:

Property Type Description
Items T[] Array of items for the current page
TotalCount int Total items across all pages
PagesCount int Total number of pages
Page int Current page index (zero-based)
Count int Number of items in current page
SortBy string Column name used for sorting
IsAsc bool True if ascending sort order
Search string Applied search query

ModelListResult

Utility class for creating ModelList<T> instances.

// Create a single-item list response
var product = await _repository.GetByIdAsync(id);
return ModelListResult.SingleItemList(product);

QueryModelAttribute

Marks a class for automatic query string parameter binding.

[QueryModel]
public class ProductQuery
{
    public int Page { get; set; }
    public int PageSize { get; set; }
    public string? Search { get; set; }
    public ProductCategory? Category { get; set; }
}

Supported types:

  • Primitives: string, bool, int, long, decimal, double
  • Date/time: DateTime, DateOnly, TimeOnly
  • Other: Guid, enums
  • Nullable versions of all above
  • Arrays and IEnumerable<T> (comma-separated values)

QueryNameAttribute

Overrides the query parameter name for a property.

[QueryModel]
public class SearchQuery
{
    [QueryName("q")]
    public string SearchText { get; set; }

    [QueryName("page_size")]
    public int PageSize { get; set; }
}

// Maps from: ?q=hello&page_size=20

Usage with ASP.NET Core

To use query model binding with ASP.NET Core, install the main package:

dotnet add package DevInstance.WebServiceToolkit

Then register the query model binder:

builder.Services.AddControllers()
    .AddWebServiceToolkitQuery();

See Also

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.
  • net10.0

    • No dependencies.

NuGet packages (2)

Showing the top 2 NuGet packages that depend on DevInstance.WebServiceToolkit.Common:

Package Downloads
DevInstance.BlazorToolkit

BlazorToolkit is a comprehensive set of tools designed to enhance the development of Blazor applications. It provides a suite of utilities and services that streamline common tasks, allowing developers to focus on building rich, interactive web applications.

DevInstance.WebServiceToolkit

ASP.NET Core utilities for web service development including query model binding, exception handling, and service registration.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
10.0.1 89 1/20/2026
10.0.0 280 11/10/2025
9.0.0 191 10/3/2025
2.1.1 696 3/17/2025