使Firebird与实体框架代码优先和迁移一起工作

时间:2014-02-12 13:18:14

标签: c# entity-framework connection-string firebird firebird-embedded

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

  

找不到ADO.NET提供程序的实体框架提供程序   不变名称'FirebirdSql.Data.FirebirdClient'。确保   提供者是在'entityFramework'部分注册的   应用配置文件。看到   http://go.microsoft.com/fwlink/?LinkId=260882了解更多信息。

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

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

1 个答案:

答案 0 :(得分:1)

firebird ado.net驱动器不支持代码First Migrations。