如何在同一项目中为多个数据库上下文启用Entity Framework 5(5.0.0版)迁移,其中每个上下文对应于其自己的数据库?当我Enable-Migrations在PM控制台(Visual Studio 2012)中运行时,由于存在多个上下文而出现错误:
PM> Enable-Migrations
More than one context type was found in the assembly 'DatabaseService'.
To enable migrations for DatabaseService.Models.Product1DbContext, use Enable-Migrations -ContextTypeName DatabaseService.Models.Product1DbContext.
To enable migrations for DatabaseService.Models.Product2DbContext, use Enable-Migrations -ContextTypeName DatabaseService.Models.Product2DbContext.
如果我运行,则Enable-Migrations -ContextTypeName DatabaseService.Models.Product1DbContext不允许运行,Enable-Migrations -ContextTypeName DatabaseService.Models.Product2DbContext因为迁移已存在:Migrations have already been enabled in project 'DatabaseService'. To overwrite the existing migrations configuration, use the -Force parameter.
qq_遁去的一_1