ITPerformance.GenericDto 1.1.0.3

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

ITPerformance.GenericDto

ITPerformance.GenericDto is a lightweight and flexible NuGet package that provides generic DTO classes and interfaces to simplify request and response models in .NET applications. It's ideal for clean API design, pagination, and standardized data transfer.

✨ Features

  • PagedResultRequestDto: For paginated requests (e.g., page number and size)
  • LimitedResultRequestDto: For requests with a maximum result count
  • PagedResultDto<T>: Standardized response wrapper for paged data
  • IEntityDto<TKey>: Interface for DTOs with a unique identifier

📦 Installation

Install via NuGet:

dotnet add package ITPerformance.GenericDto

Or using the Package Manager:

Install-Package ITPerformance.GenericDto

🚀 Usage Example

public class Car : PagedResultRequestDto, IEntityDto<Guid>
{
    public Guid Id { get; set; }
    public string Name { get; set; }
    public string Make { get; set; }
}

public class Boat : LimitedResultRequestDto, IEntityDto<Guid>
{
    public Guid Id { get; set; }
    public string Name { get; set; }
    public string Make { get; set; }
}

Usage: 📁 API Controller

[ApiController]
[Route("api/[controller]")]
public class CarsController : ControllerBase
{
    private readonly ICarRepository _carRepository;

    public CarsController(ICarRepository carRepository)
    {
        _carRepository = carRepository;
    }

    [HttpGet]
    public async Task<ActionResult<PagedResultDto<Car>>> GetCars([FromQuery] PagedResultRequestDto input)
    {
        var result = await _carRepository.GetPagedCarsAsync(input);
        return Ok(result);
    }
}

🔄 Pagination Utilities To streamline the implementation of paging logic, this package includes the PaginationHelper class and a set of extension methods under PaginationExtentions.

📌 PaginationHelper.ApplyPaging PaginationHelper.ApplyPaging automatically applies either full paging (Skip + Take) or simple limiting (Take) based on the request type:

✅ Example Usage in Repository

public async Task<PagedResultDto<Car>> GetPagedCarsAsync(PagedResultRequestDto inputDto)
{
    var query = _cars.AsQueryable(); // "cars" can be a database or whatever returns a List of a type

    // Apply paging using the helper
    var pagedQuery = PaginationHelper.ApplyPaging(query, inputDto);

    return new PagedResultDto<Car>
    {
        TotalCount = query.Count(),
        Items = pagedQuery.ToList()
    };
}

📄 Interfaces and Base Classes

Name Description
IEntityDto<TKey> Marker interface for DTOs with an ID
PagedResultRequestDto Contains PageNumber and PageSize for paginated requests
LimitedResultRequestDto Contains MaxResultCount for limiting result count
PagedResultDto<T> Contains TotalCount and Items for paginated response payloads

🛠 Purpose This package helps you standardize and streamline typical API patterns like pagination and entity identification in your .NET applications. Designed to be simple, consistent, and easy to extend.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  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 was computed.  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 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 netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  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.
  • .NETStandard 2.0

    • No dependencies.

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.1.0.3 187 5/23/2025
1.1.0.2 179 5/23/2025
1.1.0.1 182 5/23/2025
1.1.0 186 5/23/2025
1.0.1 211 5/21/2025
1.0.0 205 5/21/2025