/entity-management

Base entity classes, fluent configuration base classes and extension methods to assist with configuring EF Core

Primary LanguageC#

Entity Management

EF Core database context abstraction.

Build Status

.NET Core

Dependencies

  • .Net 6
  • Entity Framework Core 6
  • Autofac 6.x.x

How To Use

  1. All entity types that the you wish to access should inherit EntityManagement.Core.BaseEntity.
  2. Create fluent configurations for each of these data models by inheriting EntityManagement.BaseEntityConfiguration<TEntity, TId> for each entity.
  3. Implement database context by inheriting Microsoft.EntityFrameworkCore.DbContext (ensure the configurations created in step 2 are added in the OnModelCreating method).
  4. Create database context design-time factory.
  5. Call serices.ConfigureDatabaseContextAndFactory<YouDbContext>(databaseConnectionString) in the ConfigureServices method of your Startup class.