Stef.Validation.Options 0.2.0

Prefix Reserved
dotnet add package Stef.Validation.Options --version 0.2.0
                    
NuGet\Install-Package Stef.Validation.Options -Version 0.2.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="Stef.Validation.Options" Version="0.2.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Stef.Validation.Options" Version="0.2.0" />
                    
Directory.Packages.props
<PackageReference Include="Stef.Validation.Options" />
                    
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 Stef.Validation.Options --version 0.2.0
                    
#r "nuget: Stef.Validation.Options, 0.2.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.
#addin nuget:?package=Stef.Validation.Options&version=0.2.0
                    
Install Stef.Validation.Options as a Cake Addin
#tool nuget:?package=Stef.Validation.Options&version=0.2.0
                    
Install Stef.Validation.Options as a Cake Tool

🛡️ Stef.Validation.Options

This package provides an extension method to validate options using data annotations. It is useful when you want to ensure that your options are correctly configured at startup.

Usage example

Define options class
public class MyOptions
{
    [Required] // This attribute ensures that the Name property is not null or empty
    public required string Name { get; init; }
}
Validate options
using Stef.Validation.Options;

public static IServiceCollection Register(this IServiceCollection services, MyOptions options)
{
    Guard.NotNull(services);
    Guard.NotNull(options);

    // Add the options to the service collection. And throw an exception if the options are not valid.
    services.AddOptionsWithDataAnnotationValidation(options);
}

Sponsors

Entity Framework Extensions and Dapper Plus are major sponsors and proud to contribute to the development of Stef.Validation.Options.

Entity Framework Extensions

Dapper Plus

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 netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 is compatible. 
.NET Framework net461 is compatible.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  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.

NuGet packages (10)

Showing the top 5 NuGet packages that depend on Stef.Validation.Options:

Package Downloads
DistributedCache.AzureTableStorage

Distributed cache implementation of Microsoft.Extensions.Caching.Distributed.IDistributedCache using Azure Table Storage.

ModelContextProtocol-SemanticKernel

Microsoft SemanticKernel integration for the ModelContextProtocol (official C# SDK). Enables seamless use of MCP tools as AI functions.

Replicate.Net.DependencyInjection

DependencyInjection for Replicate.Net

SanitizedHttpClientLogger

Minimizes and sanitizes log output produced by HttpClient

RestEase.Authentication.Azure

Add AzureAd Authentication for RestEase: the easy-to-use typesafe REST API client library.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
0.2.0 139 6/13/2025
0.2.0-preview-02 163 6/13/2025
0.2.0-preview-01 182 6/12/2025
0.1.1 35,673 10/22/2022
0.1.0 129,110 1/20/2022

See ReleaseNotes.md