/entity-framework-core-code-first-migration-using-separate-assembly

create a Class library project, data models with DataAnnotations validation, ApplicationContext class implementing DBContext, and implement IDesignTimeDbContextFactory to avoid the use of startup class.

Primary LanguageC#

Entity Framework Core Code First Migration using Separate Assembly

This blogpost explains how to achieve Entity Framework code first migrations having Models, DBContext, and Model Snapshot files in assembly different than web or startup projects.

By following this tutorial you will create a Class library project, data models with DataAnnotations validation, A pplicationContext class implementing DBContext, and implement IDesignTimeDbContextFactory to avoid the use of startup class.

  1. DataModels has Product and Category models.
  2. Migrations/initial/ contents EF Core migration script.
  3. StoreContext.cs ApplicationContext of DBContext

EF Core First Migration

For step by step implementation click here