如何为同一项目中的多个数据库上下文启用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.