在 packagemanager 中键入 enable-migrations 时出现此错误。
找不到具有不变名称“FirebirdSql.Data.FirebirdClient”的 ADO.NET 提供程序的实体框架提供程序。确保提供程序已在应用程序配置文件的“entityFramework”部分注册。有关详细信息,请参阅 http://go.microsoft.com/fwlink/?LinkId=260882。
这是我到目前为止所做的:
- 从以下网址下载 32 位嵌入式 firebird: http ://www.firebirdsql.org/en/firebird-2-5-2-upd1/
- 将 dll 提取到我的解决方案中:http: //d.pr/i/Hsgv
- 添加了对 FirebirdSql.Data.FirebirdClient 的引用:http: //d.pr/i/7SiO
制作了这个 DataContext 类:
class DataContext : DbContext
{
public static FbConnection connection
{
get
{
FbConnectionStringBuilder b = new FbConnectionStringBuilder();
b.ServerType = FbServerType.Embedded;
b.UserID = "SYSDBA";
b.Password = "masterkey";
b.Dialect = 3;
b.Database = "D:\\cafw.fdb";
b.Charset = "WIN1251";
b.ClientLibrary = "fbembed.dll";
return new FbConnection(b.ToString());
}
}
public DataContext()
: base(connection, true)
{
}
}
请注意,这是一个控制台应用程序,所以我没有 app.config 文件来添加提供程序,并且数据库实际上并不存在,希望它为我创建了它:)