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

Prefix Reserved
This is a prerelease version of PosInformatique.Foundations.EmailAddresses.EntityFramework.
dotnet add package PosInformatique.Foundations.EmailAddresses.EntityFramework --version 1.0.0-alpha.4
                    
NuGet\Install-Package PosInformatique.Foundations.EmailAddresses.EntityFramework -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.EntityFramework" 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.EntityFramework" Version="1.0.0-alpha.4" />
                    
Directory.Packages.props
<PackageReference Include="PosInformatique.Foundations.EmailAddresses.EntityFramework" />
                    
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.EntityFramework --version 1.0.0-alpha.4
                    
#r "nuget: PosInformatique.Foundations.EmailAddresses.EntityFramework, 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.EntityFramework@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.EntityFramework&version=1.0.0-alpha.4&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=PosInformatique.Foundations.EmailAddresses.EntityFramework&version=1.0.0-alpha.4&prerelease
                    
Install as a Cake Tool

PosInformatique.Foundations.EmailAddresses.EntityFramework

NuGet version NuGet downloads

Introduction

Provides Entity Framework Core integration for the EmailAddress value object from PosInformatique.Foundations.EmailAddresses.
This package enables seamless mapping of RFC 5322 compliant email addresses as strongly-typed properties in Entity Framework Core entities.

It ensures proper SQL type mapping, validation, and conversion to VARCHAR when persisted to the database.

Install

You can install the package from NuGet:

dotnet add package PosInformatique.Foundations.EmailAddresses.EntityFramework

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

Features

  • Provides an extension method IsEmailAddress() to configure EF Core properties for EmailAddress.
  • Maps to VARCHAR(320) database columns using the SQL type EmailAddress (you must define the SQL type EmailAddress mapped to VARCHAR(320) in your database).
  • Ensures validation, normalization, and safe conversion to/from database fields.
  • Built on top of the core EmailAddress value object.

Use cases

  • Entity mapping: enforce strong typing for email addresses at the persistence layer.
  • Consistency: ensure the same validation rules are applied in your entities and database.
  • Safety: prevent invalid strings being stored in your database

Examples

⚠️ To use IsEmailAddress(), you must first define the SQL type EmailAddress mapped to VARCHAR(320) in your database.
For SQL Server, you can create it with:

CREATE TYPE EmailAddress FROM VARCHAR(320) NOT NULL;

Example: Configure an entity

using Microsoft.EntityFrameworkCore;
using PosInformatique.Foundations;

public class User
{
    public int Id { get; set; }
    public EmailAddress Email { get; set; }
}

public class ApplicationDbContext : DbContext
{
    public DbSet<User> Users => Set<User>();

    protected override void OnModelCreating(ModelBuilder modelBuilder)
    {
        modelBuilder.Entity<User>()
            .Property(u => u.Email)
            .IsEmailAddress();
    }
}

This will configure the Email property of the User entity with:

  • VARCHAR(320) column length
  • Non-Unicode
  • SQL column type EmailAddress
  • Bi-directional conversion between EmailAddress and string
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 33 9/27/2025
1.0.0-alpha.3 67 9/26/2025

1.0.0
 - Initial release with the support Entity Framework persitance for EmailAddress value object.