Skip to content

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

Notifications You must be signed in to change notification settings

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

Repository files navigation

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

About

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

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages