NuGet Package Architect.Identities.EntityFramework

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.

Info

Version: 1.0.0
Author(s): TheArchitectDev, Timovzl
Last Update: Thursday, December 31, 2020
.NET Fiddle: Create the first Fiddle
NuGet Url: https://www.nuget.org/packages/Architect.Identities.EntityFramework


Install
Install-Package Architect.Identities.EntityFramework
dotnet add package Architect.Identities.EntityFramework
paket add Architect.Identities.EntityFramework
Architect.Identities.EntityFramework Download (Unzip the "nupkg" after downloading)



Tags



STATS

must-have-score

.5

avg-downloads-per-day

3

days-since-last-release

104