Decode.Context.Abstractions 2.0.0

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

Decode.Context.Abstractions

Core contracts and interfaces for user and request context in the Decode ecosystem.

🚀 Features

  • IUserContext: Framework-agnostic interface for accessing current user identity (UserId), authentication state (IsAuthenticated), client IP address (IpAddress), User-Agent, Access Token, and custom claims across Domain and Application layers.
  • Zero Web Dependencies: Pure .NET Standard 2.1 library with zero references to ASP.NET Core or web assemblies.

📦 Installation

Add the project reference to your Domain or Application project:

dotnet add reference ../Decode.Context.Abstractions/Decode.Context.Abstractions.csproj

📖 Usage

Inject IUserContext into your Domain Handlers, Services, or Repositories:

using Decode.Context.Abstractions;

public class CreateOrderCommandHandler(IUserContext userContext, IOrderRepository repository)
{
    public async Task HandleAsync(CreateOrderCommand command, CancellationToken ct)
    {
        // 1. Safely retrieve authenticated User ID (returns Guid.Empty if unauthenticated)
        Guid userId = userContext.UserId;
        bool isAuthenticated = userContext.IsAuthenticated;

        // 2. Retrieve proxy-aware client IP address and User-Agent for audit logging
        string clientIp = userContext.IpAddress;
        string userAgent = userContext.UserAgent;

        // 3. Query custom claims
        string? tenantId = userContext.GetClaim("tenant_id");

        Order order = new(command.Amount, userId, clientIp);
        await repository.AddAsync(order, ct);
    }
}

📄 License

This project is licensed under the MIT License.

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 netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.1 is compatible. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen 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.1

    • No dependencies.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Decode.Context.Abstractions:

Package Downloads
Decode.AspNetCore

ASP.NET Core extensions for the Decode ecosystem, including global exception handling and base controllers.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
3.0.0 113 9/14/2026
2.1.0 110 9/13/2026
2.0.2 101 9/13/2026
2.0.1 103 9/13/2026
2.0.0 148 7/28/2026
1.0.0 122 7/22/2026