gpt4 book ai didi

c# - 使 Firebird 与 Entity Framework Code First 和迁移一起工作

转载 作者:太空宇宙 更新时间:2023-11-03 13:27:53 26 4
gpt4 key购买 nike

我在 packagemanager 中键入 enable-migrations 时遇到此错误。

No Entity Framework provider found for the ADO.NET provider with invariant name 'FirebirdSql.Data.FirebirdClient'. Make sure the provider is registered in the 'entityFramework' section of the application config file. See http://go.microsoft.com/fwlink/?LinkId=260882 for more information.

这是我到目前为止所做的:

创建了这个 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 文件来添加提供程序,而且数据库实际上并不存在,希望它为我创建了 :)

最佳答案

firebird ado.net 驱动器不支持代码首次迁移。

关于c# - 使 Firebird 与 Entity Framework Code First 和迁移一起工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21729082/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com