Architect.Identities.EntityFramework 2.0.0-preview-20220426.2

.NET Core 3.1
This is a prerelease version of Architect.Identities.EntityFramework.
NuGet\Install-Package Architect.Identities.EntityFramework -Version 2.0.0-preview-20220426.2
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.
dotnet add package Architect.Identities.EntityFramework --version 2.0.0-preview-20220426.2
<PackageReference Include="Architect.Identities.EntityFramework" Version="2.0.0-preview-20220426.2" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Architect.Identities.EntityFramework --version 2.0.0-preview-20220426.2
#r "nuget: Architect.Identities.EntityFramework, 2.0.0-preview-20220426.2"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. Copy this into the interactive tool or source code of the script to reference the package.
// Install Architect.Identities.EntityFramework as a Cake Addin
#addin nuget:?package=Architect.Identities.EntityFramework&version=2.0.0-preview-20220426.2&prerelease

// Install Architect.Identities.EntityFramework as a Cake Tool
#tool nuget:?package=Architect.Identities.EntityFramework&version=2.0.0-preview-20220426.2&prerelease

Release notes:

2.0.0:
- BREAKING: No longer referencing the Identities package. (Still considered an addition to it, but the hard link is now gone.)
- BREAKING: Removed ApplicationInstanceIds. (See Identities 2.0.0.)

1.0.2:
- Fixed an incompatibility with EF Core 6.0.0+ (caused by a breaking change in EF itself).
- Now using AmbientContexts 1.1.1, which fixes extremely rare bugs and improves performance.

1.0.1:
- Now using AmbientContexts 1.1.0, for a performance improvement.

Description:

EntityFramework extensions for the Architect.Identities package.

Use DbContext-based connections for the Fluid ID generator:

public void ConfigureServices(IServiceCollection services)
{
 services.AddPooledDbContextFactory<ExampleDbContext>(context => context.UseSqlServer("ConnectionString"));
 
 services.AddApplicationInstanceIdSource(source => source.UseSqlServerDbContext<ExampleDbContext>());
 
 services.AddIdGenerator(generator => generator.UseFluid());
}

Easily configure the column type to use for decimal ID columns:

protected override void OnModelCreating(ModelBuilder modelBuilder)
{
 modelBuilder.Entity<Order>(entity =>
 {
   entity.Property(o => o.Id)
     .ValueGeneratedNever();
   
   entity.HasKey(o => o.Id);
 });
 
 // Other entities ...

 // For all mapped decimal columns named *Id or *ID
 modelBuilder.StoreDecimalIdsWithCorrectPrecision(dbContext: this);
}

Or per individual property:

protected override void OnModelCreating(ModelBuilder modelBuilder)
{
 modelBuilder.Entity<Order>(entity =>
 {
   entity.Property(e => e.Id)
     .ValueGeneratedNever()
     .StoreWithDecimalIdPrecision(dbContext: this);
 });
}

The extensions in this package special-case SQLite, which requires special treatment.

Product Versions
.NET net5.0 net5.0-windows net6.0 net6.0-android net6.0-ios net6.0-maccatalyst net6.0-macos net6.0-tvos net6.0-windows
.NET Core netcoreapp3.1
Compatible target framework(s)
Additional computed target framework(s)
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
2.0.0-preview-20220426.2 84 4/26/2022
2.0.0-preview-20220426.1 61 4/26/2022
1.0.2 368 1/1/2022
1.0.0 1,304 12/31/2020