Danom.Validation
1.0.0-alpha1
See the version list below for details.
dotnet add package Danom.Validation --version 1.0.0-alpha1
NuGet\Install-Package Danom.Validation -Version 1.0.0-alpha1
<PackageReference Include="Danom.Validation" Version="1.0.0-alpha1" />
<PackageVersion Include="Danom.Validation" Version="1.0.0-alpha1" />
<PackageReference Include="Danom.Validation" />
paket add Danom.Validation --version 1.0.0-alpha1
#r "nuget: Danom.Validation, 1.0.0-alpha1"
#:package Danom.Validation@1.0.0-alpha1
#addin nuget:?package=Danom.Validation&version=1.0.0-alpha1&prerelease
#tool nuget:?package=Danom.Validation&version=1.0.0-alpha1&prerelease
Danom.Validation
One of the places the Results type really shines is input validation. It's a natural step in most workflows to validate input data before processing it, and the Result type is a great way to handle this. The Danom.Validation library provides a set of utilities to help with this and integrates with the wonderful FluentValidation library.
Getting Started
Install the Danom.Validation NuGet package:
PM> Install-Package Danom.Validation
Or using the dotnet CLI
dotnet add package Danom.Validation
Quick Start
using Danom;
using Danom.Validation;
using FluentValidation;
public record Attendee(
string Name,
int Age,
Option<string> Email,
Option<string> AlternateEmail);
public class AttendeeValidator
: AbstractValidator<Attendee>
{
public AttendeeValidator()
{
RuleFor(x => x.Name).NotEmpty();
RuleFor(x => x.Age).GreaterThan(0);
RuleFor(x => x.Email).Required(x => x.EmailAddress());
RuleFor(x => x.AlternateEmail).Optional(x => x.EmailAddress());
}
}
var input =
new Attendee(
Name: "John Doe",
Age: 30,
Email: Option<string>.Some("john@doe.com"),
AlternateEmail: Option<string>.None());
var result =
ValidationResult<Attendee>
.From<AttendeeValidator>(input);
result.Match(
x => Console.WriteLine("Input is valid: {0}", x),
e => Console.WriteLine("Input is invalid: {0}", e));
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0 is compatible. 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. |
-
net8.0
- Danom (>= 1.0.0-alpha2)
- FluentValidation (>= 11.9.2)
NuGet packages (2)
Showing the top 2 NuGet packages that depend on Danom.Validation:
Package | Downloads |
---|---|
Danom.Mvc
ASP.NET Core MVC and Razor Pages support for Danom. |
|
Danom.MinimalApi
ASP.NET Core Minimal API support for Danom. |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last Updated |
---|---|---|
2.0.0-beta6 | 147 | 8/8/2025 |
2.0.0-beta4 | 159 | 6/24/2025 |
2.0.0-beta2 | 225 | 5/16/2025 |
2.0.0-beta1 | 108 | 4/18/2025 |
1.2.0 | 152 | 12/6/2024 |
1.1.1 | 121 | 12/6/2024 |
1.0.0 | 159 | 11/20/2024 |
1.0.0-beta1 | 114 | 10/11/2024 |
1.0.0-alpha1 | 124 | 8/30/2024 |