EF Code First Migration with Multiple Database / DbContext

后端 未结 3 1186
孤城傲影
孤城傲影 2020-12-29 00:04

I have two database each with their own dbcontext. I\'ve setup two migration configurations. I can add a migration for the first db ust fine (Add-Migration DB1_Initial

3条回答
  •  有刺的猬
    2020-12-29 01:03

    With Entity Framework 6 it's easy.

    It's the same procedure for both multiple DbContexts for one database and for multiple DbContexts for each their own database:

    Enable-Migrations -ContextTypeName -MigrationsDirectory:

    Add-Migration -configuration

    Update-Database -configuration -Verbose

    Source

提交回复
热议问题