General.Frontend.Shared 3.0.3

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

Generic API Client

Reusable .NET client infrastructure for consuming ASP.NET Core APIs through HttpClient.

The package depends on the Generic Backend package for shared API contracts and data models. It does not duplicate those types. Its responsibility is the client-side HTTP infrastructure and generic API repository implementation.

Features

  • Generic IGenericAPIRepository<TResponse, TRequest> contract
  • Reusable GenericAPIRepository<TResponse, TRequest> implementation
  • GET by identifier
  • Paginated GET
  • HTTP QUERY for dynamic filtering
  • POST create
  • PUT update
  • ResponseService<T> and QueryResult<T> support
  • Bearer token support
  • Cancellation token propagation
  • Dependency-injection friendly design
  • UI agnostic

Architecture

Application / UI
       |
       v
IGenericAPIRepository<TResponse,TRequest>
       ^
       |
GenericAPIRepository<TResponse,TRequest>
       |
       v
HttpClient
       |
       v
ASP.NET Core API

The application depends on the repository contract while the generic implementation handles HTTP transport.

Quick Start

Create a resource-specific repository:

public sealed class ActivityAPIRepository(HttpClient httpClient)
    : GenericAPIRepository<ActivityDto, ActivityCreationDto>(
        httpClient,
        "activity",
        "api")
{
}

Register the abstraction:

services.AddScoped<
    IGenericAPIRepository<ActivityDto, ActivityCreationDto>,
    ActivityAPIRepository>();

Consume it through the interface:

public sealed class ActivityService(
    IGenericAPIRepository<ActivityDto, ActivityCreationDto> repository)
{
    public Task<ResponseService<ActivityDto>> GetAsync(
        int id,
        CancellationToken cancellationToken = default)
    {
        return repository.GetByIdAsync(id, cancellationToken);
    }
}

Endpoints

GET    /api/activity/{id}
GET    /api/activity?page=1&recordsByPage=20
QUERY  /api/activity/dynamic-filter
POST   /api/activity
PUT    /api/activity/{id}

Dynamic Query

var request = new QueryRequest(
    new RequestPagination(1, 20),
    filters);

var response = await repository.QueryAsync(
    request,
    cancellationToken);

Documentation

Design Principles

  • Contract-first: applications depend on IGenericAPIRepository.
  • Generic transport: HTTP construction and JSON serialization are centralized.
  • DTO-based communication: the client does not require backend persistence entities.
  • Query metadata preservation: QueryResult<T> contains records and total count.
  • Cancellation propagation: tokens flow to HttpClient.
  • UI agnostic: no dependency on Blazor, Radzen, or another UI framework.
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.

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
3.0.3 101 8/29/2026
3.0.2 104 8/28/2026
3.0.1 107 8/27/2026
3.0.0 103 8/27/2026
2.0.1 108 8/26/2026
2.0.0 107 8/25/2026
1.1.4 101 8/21/2026
1.1.3 106 8/20/2026
1.1.2 126 5/14/2026
1.1.1 122 4/4/2026
1.1.0 138 4/4/2026
1.0.1 182 1/15/2025
1.0.0 164 1/9/2025

refactor: fix thread safety, security, and correctness issues in GenericAPIRepository
- Replace DefaultRequestHeaders mutation with per-request Authorization header via
HttpRequestMessage, making SetToken/RemoveToken thread-safe
- Fix Bearer token casing (bearer -> Bearer, per RFC 6750)
- Add EnsureSuccessStatusCode() before deserializing responses in all HTTP methods,
preventing JsonException on HTML error pages (401, 502, etc.)
- Fix GetByIdAsync error reporting wrong service name ("GetAllAsync")
- Remove unused System.Runtime.InteropServices.Marshalling using
- IGenericAPIRepository: remove empty outer wrapper interface; promote generic interface
to top level
- GridUtils.SetEntityValues: fix null/type handling with Convert.ChangeType to prevent
InvalidCastException on non-string properties
- GridUtils: remove Console.WriteLine and dead try/catch blocks
- Add GeneratePackageOnBuild to .csproj for consistency with backend project
- Update General.Backend.Shared library
- Refactor change Dinamic by Dynamic
-()26/08/2026 Decoupling shared elements between the front end and the back endbeackendGeneral.B libaryr