Ardalis.SmartEnum.EFCore
9.0.0
dotnet add package Ardalis.SmartEnum.EFCore --version 9.0.0
NuGet\Install-Package Ardalis.SmartEnum.EFCore -Version 9.0.0
<PackageReference Include="Ardalis.SmartEnum.EFCore" Version="9.0.0" />
<PackageVersion Include="Ardalis.SmartEnum.EFCore" Version="9.0.0" />
<PackageReference Include="Ardalis.SmartEnum.EFCore" />
paket add Ardalis.SmartEnum.EFCore --version 9.0.0
#r "nuget: Ardalis.SmartEnum.EFCore, 9.0.0"
#:package Ardalis.SmartEnum.EFCore@9.0.0
#addin nuget:?package=Ardalis.SmartEnum.EFCore&version=9.0.0
#tool nuget:?package=Ardalis.SmartEnum.EFCore&version=9.0.0
Ardalis.SmartEnum.EFCore
IMPORTANT This is the last MIT-licensed release of this library. Future releases will require a (potentially free) commercial license. Find out more
Entity Framework Core support for Ardalis.SmartEnum. Configures value conversions for every SmartEnum property in your model with a single call, so each one is stored as its Value.
Installation
dotnet add package Ardalis.SmartEnum.EFCore
Usage
Call ConfigureSmartEnum() at the start of ConfigureConventions in your DbContext:
using Ardalis.SmartEnum.EFCore;
protected override void ConfigureConventions(ModelConfigurationBuilder configurationBuilder)
{
configurationBuilder.ConfigureSmartEnum();
}
Alternatively, call it at the end of OnModelCreating:
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
// ... your configuration
modelBuilder.ConfigureSmartEnum();
}
Upgrading from 8.x? The extension methods moved from the
SmartEnum.EFCorenamespace toArdalis.SmartEnum.EFCorein 9.0. Update yourusingdirective.
To configure a single property yourself, without this package, use a standard EF Core value conversion:
builder.Entity<Policy>()
.Property(p => p.PolicyStatus)
.HasConversion(
p => p.Value,
p => PolicyStatus.FromValue(p));
More information
See the SmartEnum project README for full documentation, including storing a SmartEnum in its own lookup table.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. 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. net11.0 is compatible. |
-
net10.0
- Ardalis.SmartEnum (>= 9.0.0)
- Microsoft.EntityFrameworkCore (>= 10.0.15)
-
net11.0
- Ardalis.SmartEnum (>= 9.0.0)
- Microsoft.EntityFrameworkCore (>= 11.0.0)
NuGet packages (7)
Showing the top 5 NuGet packages that depend on Ardalis.SmartEnum.EFCore:
| Package | Downloads |
|---|---|
|
Miru
Package Description |
|
|
CraftersCloud.Core.SmartEnums.EntityFramework
Core SmartEnums for EntityFramework |
|
|
Enigmatry.Entry.SmartEnums.EntityFramework
Building Block for support of SmartEnums with EntityFramework in an Entry based project |
|
|
FIX.Platform.Models
Domain models, DTOs and SmartEnums of the FIX Fiscal platform, shared by its API and the FIX.Platform.Client SDK. |
|
|
JordiAragon.SharedKernel.Infrastructure.EntityFramework
A simple package to implement the building blocks to follow DDD principles and Clean Architecture. |
GitHub repositories (1)
Showing the top 1 popular GitHub repositories that depend on Ardalis.SmartEnum.EFCore:
| Repository | Stars |
|---|---|
|
PhenX/PhenX.EntityFrameworkCore.BulkInsert
Super fast bulk insertion for Entity Framework Core on SQL Server, PostgreSQL, Sqlite, MySQL and Oracle
|
See root package release notes