sh-edraft.de

sh.licensing.validation (2026.2.15.4-dev)

Published 2026-02-15 10:15:43 +01:00 by ci

Installation

dotnet nuget add source --name sh-edraft.de --username your_username --password your_token 
dotnet add package --source sh-edraft.de --version 2026.2.15.4-dev sh.licensing.validation

About this package

License validation service for sh-edraft Licensing Server

SH Licensing Validation

A .NET library for license validation against the SH Licensing Server.

Installation

Install the NuGet package:

dotnet add package sh.licensing.validation

Or via Package Manager:

Install-Package sh.licensing.validation

Usage

Use environment variable LICENSE to provide the license key to your application. Alternatively, you can change the environment variable used by LicenseValidationService:

using sh.licensing.validation;

public class Example(ILicenseValidationService licenseService)
{
    public async Task Example()
    {
        bool isValid = await licenseService.Validate("your-product-name", "CUSTOM_LICENSE_ENV_VAR");
        bool hasFeatureX = await licenseService.HasFeature("feature-x", "CUSTOM_LICENSE_ENV_VAR");
        bool hasFeatureQuantityX = await licenseService.HasFeature("feature-x", 10, "CUSTOM_LICENSE_ENV_VAR");
    }
}

Setup in Dependency Injection

Register the licensing validation service in your Program.cs:

using sh.licensing.validation;

var builder = WebApplicationBuilder.CreateBuilder(args);

// Add licensing validation service
builder.Services.AddLicensing();

var app = builder.Build();

// Check for valid license on startup
// Throws an exception if no valid license is found, preventing the application from starting
await app.UseLicensing("your-product-name");

app.Run();

Using the Service to validate at runtime

Use the ILicenseValidationService interface in your controllers or services:

using sh.licensing.validation;

public class Example(ILicenseValidationService licenseService)
{
    public async Task Example()
    {
        bool isValid = await licenseService.Validate("your-product-name");
        bool hasFeatureX = await licenseService.HasFeature("feature-x");
        bool hasFeatureQuantityX = await licenseService.HasFeature("feature-x", 10);
    }
}
Details
NuGet
2026-02-15 10:15:43 +01:00
0
edraft
46 KiB
Assets (4)
Versions (3) View all
2026.2.15.6-dev 2026-02-15
2026.2.15.5-dev 2026-02-15
2026.2.15.4-dev 2026-02-15