我有一个使用Entity Framework和ObjectContext的C#应用程序。我希望实现这里提到的连接弹性:https://msdn.microsoft.com/en-us/library/dn456835(v=vs.113).aspx
如何将DbConfiguration类分配给ObjectContext(即如何告诉'ObjectContext使用配置)?
答案 0 :(得分:0)
您可以提供从DbMigrationsConfiguration<YourContext>
internal sealed class Configuration : DbMigrationsConfiguration<YourContext>
{
public Configuration()
{
AutomaticMigrationsEnabled = false;
ContextKey = "YourContext_";
}
protected override void Seed(YourContext context)
{
//Migrate your data
}
}