Ling.RemoteServices.Abstractions 1.0.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package Ling.RemoteServices.Abstractions --version 1.0.0
                    
NuGet\Install-Package Ling.RemoteServices.Abstractions -Version 1.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="Ling.RemoteServices.Abstractions" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Ling.RemoteServices.Abstractions" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="Ling.RemoteServices.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 Ling.RemoteServices.Abstractions --version 1.0.0
                    
#r "nuget: Ling.RemoteServices.Abstractions, 1.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 Ling.RemoteServices.Abstractions@1.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=Ling.RemoteServices.Abstractions&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=Ling.RemoteServices.Abstractions&version=1.0.0
                    
Install as a Cake Tool

Ling.RemoteServices.Abstractions

Project documentation | 简体中文

Ling.RemoteServices.Abstractions contains the transport-independent contract surface for Ling.RemoteServices. It includes contract attributes, shared file and error models, remote exceptions, a contract analyzer, and the contract manifest source generator. It does not reference MVC or ASP.NET Core.

Installation

Install the package in the project that owns the shared service interfaces:

dotnet add package Ling.RemoteServices.Abstractions

Define a contract

using Ling.RemoteServices.Attributes;
using Ling.RemoteServices.Models;

[RemoteService("/api/files")]
public interface IFileService
{
    [Get("{id}")]
    Task<FileInfoDto> GetAsync(
        [Path] Guid id,
        [Query] bool includeMetadata = false,
        CancellationToken cancellationToken = default);

    [Post("upload")]
    Task<Guid> UploadAsync(
        [Form("file")] RemoteUploadFile file,
        CancellationToken cancellationToken = default);

    [Get("{id}/content")]
    Task<RemoteFile> DownloadAsync(
        [Path] Guid id,
        CancellationToken cancellationToken = default);
}

Remote methods must return Task, Task<T>, ValueTask, or ValueTask<T>. A CancellationToken is treated as infrastructure: the generated client passes it to HttpClient, and the generated server handler receives the request cancellation token.

Binding attributes

Attribute Purpose
[Path] Binds a value to a route parameter.
[Query] Binds a scalar, collection, or supported query DTO to the query string.
[Header] Binds a scalar value to an HTTP header.
[Body] Selects the request body and optional media type.
[Form] Selects a form field or uploaded file.

Binding is inferred when it is unambiguous. Explicit attributes are recommended at public API boundaries because they make the wire contract visible during code review.

Multiple HTTP methods

A method may expose more than one HTTP operation. Exactly one operation must be the generated client's default:

[Get("items", IsClientDefault = true)]
[Post("items/search")]
Task<Item[]> GetItemsAsync(string? query, CancellationToken cancellationToken = default);

The server generator maps both endpoints. The client uses the default unless the caller selects another method through the Client package.

Endpoint policy attributes

The contract may select named authorization, CORS, output cache, rate limit, request timeout, and custom endpoint policies without referencing ASP.NET Core:

[RemoteService("/api/weather")]
[RemoteAuthorize("ApiUser", Roles = "WeatherReader,Administrator")]
[RemoteCors("Frontend")]
public interface IWeatherService
{
    [Get]
    [RemoteOutputCache("WeatherQueries")]
    Task<WeatherForecast[]> GetAsync();
}

Policy definitions remain in the ASP.NET Core host. Roles in one comma-delimited list are alternatives; role groups declared by separate attributes must all be satisfied.

Analyzer diagnostics

The package reports invalid contracts while editing and building, including synchronous methods, missing HTTP methods, unsupported routes and signatures, ambiguous client defaults, and duplicate HTTP operations. Invalid services do not publish a contract manifest for downstream generators.

  • Ling.RemoteServices.Client generates and runs type-safe client proxies.
  • Ling.RemoteServices.AspNetCore generates and maps Minimal API endpoints.

License

MIT

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

    • No dependencies.
  • net9.0

    • No dependencies.

NuGet packages (2)

Showing the top 2 NuGet packages that depend on Ling.RemoteServices.Abstractions:

Package Downloads
Ling.RemoteServices.Client

Type-safe generated HttpClient proxies, URL formatting, serialization, streaming, and remote error handling for Ling.RemoteServices contracts.

Ling.RemoteServices.AspNetCore

Generated ASP.NET Core Minimal API endpoints, endpoint conventions, policies, OpenAPI metadata, and server error handling for Ling.RemoteServices contracts.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
2.1.0 130 11/11/2026
2.0.0 169 9/30/2026
1.0.0 171 8/31/2026