NOF.Contract 10.5.0

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

NOF.Contract

Contract layer package for the NOF Framework.

Overview

Defines the messaging contracts and shared models that form the public API surface of your application. This package contains Result<T>, Empty, HTTP endpoint annotations, and other shared attributes used by source generators and hosts.

Key Abstractions

Messages

// Request with response
public record GetOrderRequest(Guid Id);

// Request without payload response
public record ArchiveOrderRequest(Guid Id);

// Fire-and-forget command
public record SendEmailCommand(string To, string Subject, string Body);

// Publish/subscribe notification
public record OrderCreatedNotification(Guid OrderId);

Result Type

// Success
return Result.Success(orderDto);

// Failure
return Result.Fail("404", "Order not found");

RPC Contracts

RPC service methods use a strict single-request signature, do not accept CancellationToken on the contract surface, do not end with Async, and must return a non-Task, non-void value. The return type does not need to be Result-based.

public record GetOrderRequest(Guid Id);
public record CreateOrderRequest(string ProductName, int Quantity);

public interface IOrderService : IRpcService
{
    [Summary("Get order")]
    [HttpEndpoint(HttpVerb.Get, "/api/orders/get")]
    Result<OrderDto> Get(GetOrderRequest request);

    [Summary("Create order")]
    [HttpEndpoint(HttpVerb.Post, "/api/orders")]
    Result<OrderDto> Create(CreateOrderRequest request);

    [Summary("Archive order")]
    [HttpEndpoint(HttpVerb.Post, "/api/orders/archive")]
    Empty Archive(ArchiveOrderRequest request);
}

Other Annotations

  • [HttpEndpoint] - declares HTTP verb and route metadata for RPC methods
  • Route parameters such as "{id}" are not supported for RPC HTTP endpoints; put input data on the request object instead
  • [RequirePermission] - declares required permissions for an endpoint
  • [Summary] - adds summary documentation to generated endpoints
  • These NOF-specific attributes are all metadata-backed and converge on MetadataAttribute

Installation

dotnet add package NOF.Contract

License

Apache-2.0

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 (6)

Showing the top 5 NuGet packages that depend on NOF.Contract:

Package Downloads
NOF.Application

Application layer for the NOF Framework — request/command/notification handlers, state machines, caching, and unit of work.

NOF.Test

Testing support for applications built with NOF, including lightweight test hosts, scoped execution helpers, and application-oriented integration testing utilities.

NOF.Hosting.Abstraction

Hosting abstractions for the NOF Framework — host builder interfaces and step contracts shared by different hosting environments.

NOF.UI

Reusable UI primitives for the NOF Framework - authorization components, browser storage abstractions, and client-side cache services.

NOF.Contract.Extension.Authorization.Jwt

JWT authorization contract extension for the NOF Framework — request/response models and service interfaces for JWT operations.

GitHub repositories

This package is not used by any popular GitHub repositories.