我想設置Firebird與EF6作爲我正在寫一個簡單的應用程序的嵌入式服務器,但一直未能得到它的工作。我有一個CLI項目,它是應用程序,DAL項目是數據庫。我加入的NuGet包都和創建一個簡單的實體的DbContext,並創建了一個初始遷移成功,但是當試圖運行update-database
執行我的包管理器控制檯收到此錯誤遷移:新的嵌入式Firebird,代碼優先,EF6項目結果SerializationException
System.Runtime.Serialization.SerializationException: Type is not resolved for member 'FirebirdSql.Data.FirebirdClient.FbException,FirebirdSql.Data.FirebirdClient, Version=4.10.0.0, Culture=neutral, PublicKeyToken=3750abcc3150b00c'.
at System.AppDomain.DoCallBack(CrossAppDomainDelegate callBackDelegate)
at System.Data.Entity.Migrations.Design.ToolingFacade.Run(BaseRunner runner)
at System.Data.Entity.Migrations.Design.ToolingFacade.Update(String targetMigration, Boolean force)
at System.Data.Entity.Migrations.UpdateDatabaseCommand.<>c__DisplayClass2.<.ctor>b__0()
at System.Data.Entity.Migrations.MigrationsDomainCommand.Execute(Action command)
Type is not resolved for member 'FirebirdSql.Data.FirebirdClient.FbException,FirebirdSql.Data.FirebirdClient, Version=4.10.0.0, Culture=neutral, PublicKeyToken=3750abcc3150b00c'.
其實我只是注意到現在沒有任何工作......如果我刪除我的遷移並嘗試重新創建它,我得到這個錯誤。我之前可以啓用遷移並創建一個遷移,但現在我不能。離奇。
我所有的項目都針對.NET 4.5.2,它們都具有相同的軟件包版本。我的解決方案/項目路徑中沒有空格或&符或怪異字符。我已經嘗試使用我的應用程序項目作爲啓動項目和DAL項目,這沒有什麼不同。
我packages.config
:
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="EntityFramework" version="6.1.3" targetFramework="net452" />
<package id="EntityFramework.Firebird" version="4.10.0.0" targetFramework="net452" />
<package id="FirebirdSql.Data.FirebirdClient" version="4.10.0.0" targetFramework="net452" />
</packages>
我App.config
:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
</configSections>
<connectionStrings>
<add name="DAL.DbContext" providerName="FirebirdSql.Data.FirebirdClient" connectionString="User=SYSDBA;Password=masterkey;Database=SampleDatabase.fdb;DataSource=localhost;Port=3050;Dialect=3;Charset=NONE;Role=;Connection lifetime=15;Pooling=true;MinPoolSize=0;MaxPoolSize=50;Packet Size=8192;ServerType=1;" />
</connectionStrings>
<entityFramework>
<defaultConnectionFactory type="FirebirdSql.Data.EntityFramework6.FbConnectionFactory, EntityFramework.Firebird" />
<providers>
<!--<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />-->
<provider invariantName="FirebirdSql.Data.FirebirdClient" type="FirebirdSql.Data.EntityFramework6.FbProviderServices, EntityFramework.Firebird" />
</providers>
</entityFramework>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="FirebirdSql.Data.FirebirdClient" publicKeyToken="3750abcc3150b00c" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.5.0.0" newVersion="4.5.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
</startup>
<system.data>
<DbProviderFactories>
<remove invariant="FirebirdSql.Data.FirebirdClient" />
<add name="FirebirdClient Data Provider" invariant="FirebirdSql.Data.FirebirdClient" description=".NET Framework Data Provider for Firebird" type="FirebirdSql.Data.FirebirdClient.FirebirdClientFactory, FirebirdSql.Data.FirebirdClient" />
</DbProviderFactories>
</system.data>
</configuration>
我剛在網上發現,這樣可能是錯的,但我找不到它的任何文件的連接字符串。 ..
我已經完成了代碼優先使用SqlServer幾十次,之前從未遇到過這個問題,但這個應用程序不會有一個真正的服務器擊中。不幸的是,這似乎是比Firebird或EF更普遍的問題,但我不確定哪裏可以看到這一點。