Stef.Validation
0.2.0-preview-01
Prefix Reserved
See the version list below for details.
dotnet add package Stef.Validation --version 0.2.0-preview-01
NuGet\Install-Package Stef.Validation -Version 0.2.0-preview-01
<PackageReference Include="Stef.Validation" Version="0.2.0-preview-01" />
<PackageVersion Include="Stef.Validation" Version="0.2.0-preview-01" />
<PackageReference Include="Stef.Validation" />
paket add Stef.Validation --version 0.2.0-preview-01
#r "nuget: Stef.Validation, 0.2.0-preview-01"
#:package Stef.Validation@0.2.0-preview-01
#addin nuget:?package=Stef.Validation&version=0.2.0-preview-01&prerelease
#tool nuget:?package=Stef.Validation&version=0.2.0-preview-01&prerelease
Stef.Validation
Guard methods for argument validation (NotNull, NotEmpty, ...)
Usage example Stef.Validation
using Stef.Validation;
public Person(string name, int age)
{
Guard.NotNullOrEmpty(name, nameof(name));
Guard.NotNullOrEmpty(name); // It's also possible to omit the `nameof(...)`-statement because CallerArgumentExpression is used internally.
Guard.Condition(age, a => a > 0, nameof(age));
}
Usage example 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.
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);
}
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 is compatible. net5.0-windows was computed. net6.0 is compatible. 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 | netcoreapp1.0 was computed. netcoreapp1.1 was computed. netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 is compatible. |
.NET Standard | netstandard1.0 is compatible. netstandard1.1 was computed. netstandard1.2 was computed. netstandard1.3 is compatible. netstandard1.4 was computed. netstandard1.5 was computed. netstandard1.6 was computed. netstandard2.0 is compatible. netstandard2.1 is compatible. |
.NET Framework | net20 is compatible. net35 is compatible. net40 is compatible. net403 was computed. net45 was computed. net451 was computed. net452 was computed. net46 was computed. net461 was computed. 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 | tizen30 was computed. tizen40 was computed. tizen60 was computed. |
Universal Windows Platform | uap was computed. uap10.0 was computed. |
Windows Phone | wp8 was computed. wp81 was computed. wpa81 was computed. |
Windows Store | netcore was computed. netcore45 was computed. netcore451 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETCoreApp 3.1
- No dependencies.
-
.NETFramework 2.0
- LinqBridge (>= 1.3.0)
-
.NETFramework 3.5
- No dependencies.
-
.NETFramework 4.0
- No dependencies.
-
.NETStandard 1.0
- NETStandard.Library (>= 1.6.1)
-
.NETStandard 1.3
- NETStandard.Library (>= 1.6.1)
-
.NETStandard 2.0
- No dependencies.
-
.NETStandard 2.1
- No dependencies.
-
net5.0
- No dependencies.
-
net6.0
- No dependencies.
NuGet packages (42)
Showing the top 5 NuGet packages that depend on Stef.Validation:
Package | Downloads |
---|---|
Handlebars.Net.Helpers.Core
Core functionality for Handlebars.Net.Helpers |
|
RandomDataGenerator.Net
This is a configurable generator to create random data like Lorum Ipsum Text, Words, Text Patterns, First/Last Names, IP-Addresses, Guids, DateTime and more. |
|
WireMock.Net.OpenApiParser
An OpenApi (swagger) parser to generate MappingModel or mapping.json file. |
|
ProtoBufJsonConverter
Convert a protobuf message to a JSON string or object (and back) using the proto definition file. |
|
MetadataReferenceService.Abstractions
This package defines the IMetadataReferenceService interface. |
GitHub repositories (2)
Showing the top 2 popular GitHub repositories that depend on Stef.Validation:
Repository | Stars |
---|---|
chocolatey/choco
Chocolatey - the package manager for Windows
|
|
wiremock/WireMock.Net
WireMock.Net is a flexible product for stubbing and mocking web HTTP responses using advanced request matching and response templating. Based on the functionality from http://WireMock.org, but extended with more functionality.
|
Version | Downloads | Last Updated |
---|---|---|
0.2.0 | 4,426 | 6/13/2025 |
0.2.0-preview-02 | 466 | 6/13/2025 |
0.2.0-preview-01 | 307 | 6/12/2025 |
0.1.1 | 18,116,432 | 10/22/2022 |
0.1.0 | 15,913,589 | 12/29/2021 |
0.0.4 | 5,997 | 10/27/2021 |
0.0.3 | 46,459 | 4/23/2021 |
0.0.2 | 19,798 | 2/10/2021 |
0.0.1 | 1,074 | 2/10/2021 |
See ReleaseNotes.md