ClosedValues.EntityFrameworkCore 1.0.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package ClosedValues.EntityFrameworkCore --version 1.0.0
                    
NuGet\Install-Package ClosedValues.EntityFrameworkCore -Version 1.0.0
                    
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="ClosedValues.EntityFrameworkCore" Version="1.0.0">
  <PrivateAssets>all</PrivateAssets>
  <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="ClosedValues.EntityFrameworkCore" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="ClosedValues.EntityFrameworkCore">
  <PrivateAssets>all</PrivateAssets>
  <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
                    
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 ClosedValues.EntityFrameworkCore --version 1.0.0
                    
#r "nuget: ClosedValues.EntityFrameworkCore, 1.0.0"
                    
#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 ClosedValues.EntityFrameworkCore@1.0.0
                    
#: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=ClosedValues.EntityFrameworkCore&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=ClosedValues.EntityFrameworkCore&version=1.0.0
                    
Install as a Cake Tool

ClosedValues.EntityFrameworkCore

EF Core value converters for ClosedValues types. The package depends on ClosedValues and brings it along.

Every closed value type gets a nested ClosedValueEfCoreConverter. It stores the key in a column of the key's type, such as "EUR" or 3, or the field name when the type has no key. On EF Core 6 or later, one extension method per assembly registers the converter of every closed value type in that assembly:

protected override void ConfigureConventions(ModelConfigurationBuilder configurationBuilder)
{
    configurationBuilder.ConfigureClosedValues();
}

Queries such as orders.Where(order => order.Currency == Currency.Euro) translate to a comparison of the stored value. To map one property only, use HasConversion<Currency.ClosedValueEfCoreConverter>().

ConfigureClosedValues is internal to the assembly that declares the closed value types. A DbContext in another assembly calls Properties<T>().HaveConversion<T.ClosedValueEfCoreConverter>() per type instead.

Turn the converters off for one type with [ClosedValue(EfCore = false)], or for the whole project with <ClosedValuesEfCore>false</ClosedValuesEfCore>. A setting on the type wins.

There are no supported framework assets in this 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.1.0 85 11/19/2026
1.0.0 87 11/19/2026