Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

system.data column 'invariantname' is constrained to be unique

I'm using FirebirdSqlProvider 4.8.1.1 and EntityFramework 6.0 I get the exception system.data column 'invariantname' is constrained to be unique when I'm trying to use EntityFramework. My app.config file:

<entityFramework>
    <defaultConnectionFactory type="FirebirdSql.Data.EntityFramework6.FbConnectionFactory, EntityFramework.Firebird" />
    <providers>
      <provider invariantName="FirebirdSql.Data.FirebirdClient" type="FirebirdSql.Data.EntityFramework6.FbProviderServices, EntityFramework.Firebird" />
      <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
    </providers>
</entityFramework>
<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>

I have only one DbProviderFactories entity in my machine.confgi file. How to fix it?

like image 285
Sergеу Isupov Avatar asked Oct 23 '15 12:10

Sergеу Isupov


1 Answers

For me there was a duplicate IBM DB2 provider.

I had to navigate to:

C:\Windows\Microsoft.NET\Framework\v2.0.50727\CONFIG

And then open the machine.config file and remove the duplicated line.

The 2 lines were:

  <add name="IBM DB2 for i .NET Provider" invariant="IBM.Data.DB2.iSeries" description=".NET Framework Data Provider for IBM i" type="IBM.Data.DB2.iSeries.iDB2Factory, IBM.Data.DB2.iSeries, Version=12.0.0.0, Culture=neutral, PublicKeyToken=9cdb2ebfb1f93a26"/>
like image 176
John M Avatar answered Oct 23 '22 05:10

John M