我试图将data source=(local);initial catalog=xxx;integrated security=false;user id=sa;password=yyy;
传递给我的EFDbContext。我所做的是
public class EFDbContext : DbContext
{
public EFDbContext() : base(@"data source=(local);initial catalog=xxx;integrated security=false;userid=sa;password=yyy;MultipleActiveResultSets=True;App=EntityFramework")
{
}
}
但它引起了一个错误说
“不支持关键字:'初始目录'”
当我运行程序时。这是我的连接字符串格式的问题吗?
答案 0 :(得分:0)
public class EFDbContext : DbContext
{
public EFDbContext() : base(@"data source=(local);initial catalog=xxx;integrated security=false;userid=sa;password=yyy;MultipleActiveResultSets=True;App=EntityFramework")
{
this.Database.Connection.Provider = "System.Data.SqlClient";
}
}