New Embedded Firebird, First Code, EF6 Project Throws SerializationException

I am trying to configure Firebird with EF6 as an embedded server for a simple application that I am writing but could not get it to work. I have a CLI project, which is an application and a DAL project, which is a database. I added NuGet packages to both and created a DbContext with a simple entity and successfully created the initial migration, but when I tried update-databaseto execute the migration, I received this error in the package manager console:

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'.

In fact, I just noticed that nothing is working now ... If I delete my migration and try to recreate it, I get this error. I managed to enable migrations and create them earlier, but now I can’t. Bizarre

All of my projects are targeting .NET 4.5.2, and they all have the same package versions. There are no spaces or ampersands or strange characters in my solution / project path. I tried using my application project as a launch project and a DAL project, and this did not help.

My 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>

My 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>

The connection string I just found on the network, so this might be wrong, but I did not find any documentation for it ...

I have already done the EF code dozens of times with SqlServer before and have never encountered this problem before, but this application will not have a real server. Unfortunately, this seems like a more general problem than Firebird or EF, but I'm not sure where to even look at this point.

+4
2

, , . , 6.2. , . , Entity Framework 6.2 , , , 6.1.3

, , , , . , Visual Studio .

, , .

+3

EF. 6.2.

+2

Source: https://habr.com/ru/post/1625600/


All Articles