项目作者: swisschain

项目描述 :
Entity Framework Core extensions
高级语言: C#
项目地址: git://github.com/swisschain/Swisschain.Extensions.EfCore.git
创建时间: 2020-11-25T08:17:54Z
项目社区:https://github.com/swisschain/Swisschain.Extensions.EfCore

开源协议:Apache License 2.0

下载


Swisschain.Extensions.EfCore Nuget library

Entity Framework Core extensions

Usage

To run DB schema migration on the service startup add next code to you DI container configuration:

  1. services.AddEfCoreDbMigration(c =>
  2. {
  3. c.UseDbContextFactory(s => s.GetRequiredService<MyDatabaseContext>());
  4. });

It’s reasonable to do this in the worker (background) unit. If your service has several background units, do it only in the single unit.

To run DB schema validtion on the service startup add next code to you DI container configuration:

  1. services.AddEfCoreDbValidation(c =>
  2. {
  3. c.UseDbContextFactory(s => s.GetRequiredService<MyDatabaseContext>());
  4. });

It’s reasonable to do this in API units and secondary worker units.