Stef.Validation 0.2.0-preview-01
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);
}
Showing the top 20 packages that depend on Stef.Validation.
| Packages | Downloads |
|---|---|
|
ProtoBufJsonConverter
Convert a protobuf message to a JSON string or object (and back) using the proto definition file.
|
21 |
|
ProtoBufJsonConverter
Convert a protobuf message to a JSON string or object (and back) using the proto definition file.
|
19 |
|
ProtoBufJsonConverter
Convert a protobuf message to a JSON string or object (and back) using the proto definition file.
|
18 |
|
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.
|
17 |
|
WireMock.Net.Shared
Shared interfaces, models, enumerations and types.
|
17 |
|
WireMock.Net.OpenApiParser
An OpenApi (swagger) parser to generate MappingModel or mapping.json file.
|
17 |
|
ProtoBufJsonConverter
Convert a protobuf message to a JSON string or object (and back) using the proto definition file.
|
17 |
|
WireMock.Net.Shared
Shared interfaces, models, enumerations and types.
|
16 |
|
ProtoBufJsonConverter
Convert a protobuf message to a JSON string or object (and back) using the proto definition file.
|
16 |
|
ProtoBufJsonConverter
Convert a protobuf message to a JSON string (and back) using the proto definition file.
|
16 |
|
WireMock.Net
Lightweight Http Mocking Server for .Net, inspired by WireMock from the Java landscape.
|
16 |
|
WireMock.Net.OpenApiParser
An OpenApi (swagger) parser to generate MappingModel or mapping.json file.
|
16 |
|
WireMock.Net.Shared
Shared interfaces, models, enumerations and types.
|
15 |
|
ProtoBufJsonConverter
Convert a protobuf message to a JSON string or object (and back) using the proto definition file.
|
15 |
|
WireMock.Net.OpenApiParser
An OpenApi (swagger) parser to generate MappingModel or mapping.json file.
|
15 |
See ReleaseNotes.md
.NET Framework 2.0
- LinqBridge (>= 1.3.0)
.NET Framework 3.5
- No dependencies.
.NET Framework 4.0
- No dependencies.
.NET Standard 1.0
- NETStandard.Library (>= 1.6.1)
.NET Standard 1.3
- NETStandard.Library (>= 1.6.1)
.NET Core 3.1
- No dependencies.
.NET 5.0
- No dependencies.
.NET 6.0
- No dependencies.
.NET Standard 2.0
- No dependencies.
.NET Standard 2.1
- No dependencies.
| Version | Downloads | Last updated |
|---|---|---|
| 0.3.0 | 20 | 09/30/2026 |
| 0.2.0 | 13 | 10/01/2026 |
| 0.2.0-preview-02 | 10 | 09/30/2026 |
| 0.2.0-preview-01 | 11 | 10/01/2026 |
| 0.1.1 | 15 | 09/30/2026 |
| 0.1.0 | 10 | 10/01/2026 |
| 0.0.4 | 11 | 10/01/2026 |
| 0.0.3 | 14 | 10/01/2026 |
| 0.0.2 | 14 | 10/01/2026 |
| 0.0.1 | 11 | 10/01/2026 |