PosInformatique.Foundations.EmailAddresses.FluentValidation 1.0.0-alpha.4

Prefix Reserved
This is a prerelease version of PosInformatique.Foundations.EmailAddresses.FluentValidation.
dotnet add package PosInformatique.Foundations.EmailAddresses.FluentValidation --version 1.0.0-alpha.4
                    
NuGet\Install-Package PosInformatique.Foundations.EmailAddresses.FluentValidation -Version 1.0.0-alpha.4
                    
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="PosInformatique.Foundations.EmailAddresses.FluentValidation" Version="1.0.0-alpha.4" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="PosInformatique.Foundations.EmailAddresses.FluentValidation" Version="1.0.0-alpha.4" />
                    
Directory.Packages.props
<PackageReference Include="PosInformatique.Foundations.EmailAddresses.FluentValidation" />
                    
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 PosInformatique.Foundations.EmailAddresses.FluentValidation --version 1.0.0-alpha.4
                    
#r "nuget: PosInformatique.Foundations.EmailAddresses.FluentValidation, 1.0.0-alpha.4"
                    
#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.
#:package PosInformatique.Foundations.EmailAddresses.FluentValidation@1.0.0-alpha.4
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=PosInformatique.Foundations.EmailAddresses.FluentValidation&version=1.0.0-alpha.4&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=PosInformatique.Foundations.EmailAddresses.FluentValidation&version=1.0.0-alpha.4&prerelease
                    
Install as a Cake Tool

PosInformatique.Foundations.EmailAddresses.FluentValidation

NuGet version NuGet downloads

Introduction

This package provides a FluentValidation extension for validating email addresses using the EmailAddress value object.

It ensures that only valid RFC 5322 compliant email addresses are accepted when validating string properties.

  • null string values are ignored (considered valid).
  • To require non-null values, combine with the NotNull() or/and NotEmpty().

Install

You can install the package from NuGet:

dotnet add package PosInformatique.Foundations.EmailAddresses.FluentValidation

This package depends on the base package PosInformatique.Foundations.EmailAddresses.

Features

  • FluentValidation extension for email address validation
  • Uses the same parsing and validation rules as the EmailAddress value object
  • Clear and consistent error messages

null values are accepted (combine with NotNull() validator to forbid nulls)

Usage

Basic validation

using FluentValidation;

public class User
{
    public string Email { get; set; }
}

public class UserValidator : AbstractValidator<User>
{
    public UserValidator()
    {
        RuleFor(u => u.Email).MustBeEmailAddress();
    }
}

Null values are ignored

var validator = new UserValidator();

// Valid, because null is ignored
var result1 = validator.Validate(new User { Email = null });
Console.WriteLine(result1.IsValid); // True

// Valid, because it's a valid email
var result2 = validator.Validate(new User { Email = "alice@company.com" });
Console.WriteLine(result2.IsValid); // True

// Invalid, because it's not a valid email
var result3 = validator.Validate(new User { Email = "not-an-email" });
Console.WriteLine(result3.IsValid); // False

Require non-null values

public class UserValidator : AbstractValidator<User>
{
    public UserValidator()
    {
        RuleFor(u => u.Email)
            .NotEmpty()             // Disallow null and empty
            .MustBeEmailAddress();
    }
}
Product Compatible and additional computed target framework versions.
.NET net9.0 is compatible.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.0-alpha.4 31 9/27/2025
1.0.0-alpha.3 65 9/26/2025

1.0.0
 - Initial release with the support FluentValidation for the validation of EmailAddress value object.