Auto Load Configurations for EntityFrameworkCore
This is an add-in for EntityFrameworkCore
Allow to use same configurations existing in EntityFramework 6 to auto load configurations.
To Install from the Nuget Package Manager Console
PM > Install-Package EntityFrameworkCore.AutoLoad
NET CLI - dotnet add package EntityFrameworkCore.AutoLoad
paket paket add EntityFrameworkCore.AutoLoad
Available here https://www.nuget.org/packages/EntityFrameworkCore.AutoLoad/#
Just call it from OnModelCreating
in DbContext
class it will read all your configuratons where they implement IEntityTypeConfiguration
public class TestContext : DbContext
{
public TestContext(DbContextOptions<TestContext> options)
: base(options)
{
}
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
modelBuilder.AddFromAssembly(typeof(TestContext).Assembly);
base.OnModelCreating(modelBuilder);
}
}
Sample here Usage
Created by Mariana Alemanno
Made with ❤ in DGENIX