Architect.Identities.EntityFramework 1.0.2

.NET Core 3.1
There is a newer prerelease version of this package available.
See the version list below for details.
Install-Package Architect.Identities.EntityFramework -Version 1.0.2
dotnet add package Architect.Identities.EntityFramework --version 1.0.2
<PackageReference Include="Architect.Identities.EntityFramework" Version="1.0.2" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Architect.Identities.EntityFramework --version 1.0.2
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Architect.Identities.EntityFramework, 1.0.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=1.0.2

// Install Architect.Identities.EntityFramework as a Cake Tool
#tool nuget:?package=Architect.Identities.EntityFramework&version=1.0.2
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

Release notes:

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 39 4/26/2022
2.0.0-preview-20220426.1 34 4/26/2022
1.0.2 157 1/1/2022
1.0.0 912 12/31/2020