Page 1 of 1

No compatible provider found (EF6)

Posted: Wed 05 Mar 2014 13:25
by Wired
I'm currently evaluating the Devart Oracle provider (Professional, 30-day trial) using VS2013 and latest (stable) Entity Framework, which is 6.0.2 at the time of writing. I started out with a fresh solution, pulled in EF via Nuget added provider and factory in my App.config and then tried to add a new EDMX. Data connection went fine (via dotConnect for Oracle) but there appears to be no support for EF6 after all, as I'm prompted with the following message:

Your project references the latest version of Entity Framework; however, an Entity Framework database provider compatible with this version could not be found for your data connection.

(this is on the wizard page where I'm supposed to choose a version for EF, with 6.0 as the only option but that option is disabled).

Here's my App.config:

Code: Select all

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <configSections>
    <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
    <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
  </configSections>
  <startup>
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
  </startup>
  <entityFramework>
    <providers>
      <provider invariantName="Devart.Data.Oracle" type="Devart.Data.Oracle.Entity.OracleEntityProviderServices, Devart.Data.Oracle.Entity, Version=8.2.103.6, Culture=neutral, PublicKeyToken=09af7300eec23701" />
    </providers>
    <system.data>
       <DbProviderFactories>
          <remove invariant="Devart.Data.Oracle" />
          <add name="dotConnect for Oracle" invariant="Devart.Data.Oracle" description="Devart dotConnect for Oracle" type="Devart.Data.Oracle.OracleProviderFactory, Devart.Data.Oracle, Version=8.2.103.0, Culture=neutral, PublicKeyToken=09af7300eec23701" />
       </DbProviderFactories>
    </system.data>
  </entityFramework>
</configuration>
Any hints what I'm missing here?

Re: No compatible provider found (EF6)

Posted: Thu 06 Mar 2014 06:53
by MariiaI
Please re-write your App.config in the following way:

Code: Select all

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <configSections>
    <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
    <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
  </configSections>
   <entityFramework>
    <providers>
      <provider invariantName="Devart.Data.Oracle" type="Devart.Data.Oracle.Entity.OracleEntityProviderServices, Devart.Data.Oracle.Entity, Version=8.2.103.6, Culture=neutral, PublicKeyToken=09af7300eec23701" />
    </providers>
  </entityFramework>
    <system.data>
       <DbProviderFactories>
          <remove invariant="Devart.Data.Oracle" />
          <add name="dotConnect for Oracle" invariant="Devart.Data.Oracle" description="Devart dotConnect for Oracle" type="Devart.Data.Oracle.OracleProviderFactory, Devart.Data.Oracle, Version=8.2.103.0, Culture=neutral, PublicKeyToken=09af7300eec23701" />
       </DbProviderFactories>
    </system.data>
 <startup>
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
  </startup>
</configuration>
Please tell us about the results.

Re: No compatible provider found (EF6)

Posted: Thu 06 Mar 2014 08:09
by Wired
That curiously did the trick - why would moving the <startup> section around do that? Strange.

However, there appear to be some performance issues. Retrieving the data objects took all off 6(!) minutes. I chose a single table and then waited for another minute to get that one pulled in. I somehow doubt this is network related.

Will run some tests now and report back if anything should not work as expected.

Re: No compatible provider found (EF6)

Posted: Thu 06 Mar 2014 13:10
by MariiaI
That curiously did the trick - why would moving the <startup> section around do that? Strange.
This is not related to dotConnect for Oracle; this is an Entity Framework peculiarity.
Also, you had an error in the entityframework section - you have placed the system.data section in the entityframework section.

As for the performance issue, if tests show that it is not network related, please send us a small test project with the corresponding DDL/DMl scripts so that we are able to investigate it.

Re: No compatible provider found (EF6)

Posted: Thu 06 Mar 2014 14:58
by Wired
I'm now in the process of integrating the dotConnect provider into a larger project of ours, which is basically an application server with WCF endpoints that we ship as part of a package. Depending on the customer, either SQL Server or Oracle have to be wired up, so we have a EDMX generated for SQL Server and pull the Oracle SSDL in, when the customer has an Oracle DBMS; CSDL and MSL are shared.

This worked OK with the Oracle.Data.Access provider, there were some quirks, to be sure but we worked around those.

dotConnect for Oracle poses the following problem: The properties from the entity types do in some cases not match the actual .NET types. Let me elaborate.

Here's what the native Oracle provider generated for the table named DB_INFO:

Code: Select all

        <EntityType Name="DB_INFO">
          <Key>
            <PropertyRef Name="Z_DB" />
          </Key>
          <Property Name="Z_DB" Type="number" Nullable="false" Precision="10" />
          <Property Name="TYP" Type="number" Precision="10" />
          <Property Name="MODUL" Type="number" Precision="10" />
          <Property Name="NAME" Type="varchar2" MaxLength="250" />
          <Property Name="USERNAME" Type="varchar2" MaxLength="250" />
          <Property Name="PASSWORT" Type="varchar2" MaxLength="250" />
          <Property Name="GUIDDB" Type="varchar2" MaxLength="250" />
          <Property Name="BEREICHE" Type="clob" />
          <Property Name="BEREICHEPD" Type="clob" />
          <Property Name="CONSTR" Type="clob" />
        </EntityType>
Compare this to what dotConnect for Oracle returns:

Code: Select all

  <EntityType Name="DB_INFO">
    <Key>
      <PropertyRef Name="Z_DB" />
    </Key>
    <Property Name="Z_DB" Type="int64" Nullable="false" />
    <Property Name="TYP" Type="int64" />
    <Property Name="MODUL" Type="int64" />
    <Property Name="NAME" Type="VARCHAR2" MaxLength="250" />
    <Property Name="USERNAME" Type="VARCHAR2" MaxLength="250" />
    <Property Name="PASSWORT" Type="VARCHAR2" MaxLength="250" />
    <Property Name="GUIDDB" Type="VARCHAR2" MaxLength="250" />
    <Property Name="BEREICHE" Type="CLOB" />
    <Property Name="BEREICHEPD" Type="CLOB" />
    <Property Name="CONSTR" Type="CLOB" />
  </EntityType>
As I already mentioned, CSDL and MSL are shared so both SSDLs map to the same .NET types. Here's the one for DB_INFO:

Code: Select all

        <EntityType Name="DB_INFO">
          <Key>
            <PropertyRef Name="Z_DB" />
          </Key>
          <Property Type="Int32" Name="Z_DB" Nullable="false" />
          <Property Type="Int32" Name="TYP" />
          <Property Type="Int32" Name="MODUL" />
          <Property Type="String" Name="NAME" MaxLength="250" FixedLength="false" Unicode="false" />
          <Property Type="String" Name="USERNAME" MaxLength="250" FixedLength="false" Unicode="false" />
          <Property Type="String" Name="PASSWORT" MaxLength="250" FixedLength="false" Unicode="false" />
          <Property Type="String" Name="GUIDDB" MaxLength="250" FixedLength="false" Unicode="false" />
          <Property Type="String" Name="BEREICHE" MaxLength="Max" FixedLength="false" Unicode="false" />
          <Property Type="String" Name="BEREICHEPD" MaxLength="Max" FixedLength="false" Unicode="false" />
          <Property Type="String" Name="CONSTR" MaxLength="Max" FixedLength="false" Unicode="false" />
        </EntityType>
Now take Z_DB, for example. Type="number" Nullable="false" Precision="10" (Oracle) maps alright to .NET type Int32 (int), but of course, Type="int64" Nullable="false" (dotConnect) does not.

And that is exactly why I'm seeing InvalidOperationExceptions right now:

The type of the key field 'Z_DB' is expected to be 'System.Int32', but the value provided is actually of type 'System.Int64'.

So the question is, is there some way to change this behavior?

Re: No compatible provider found (EF6)

Posted: Fri 07 Mar 2014 13:45
by MariiaI
When working with EDM Designer (ADO.NET Entity Data Model, *.edmx), the NumberMappings connection string property should be used:
http://www.devart.com/dotconnect/oracle ... rType.html
http://www.devart.com/dotconnect/oracle ... tring.html (see
Number Mappings here).

If you are working with Devart Entity Model, it is possible to change the default mapping before creating an Entity Framework model via the Database-First approach in the following way:
- open Tools -> Entity Developer -> Options -> Server Options -> Oracle;
- click the "Add" button for adding a new type mapping rule or change an existing one;
- click 'OK' to save the changes.

Also, there is another way:
- open your model in Entity Developer (the *.edmx file created from SQL Server), save it as *.edml file;
- specify the connection to Oracle as the model connection;
- change mapping settings, if necessary, as it is described above;
- save the changes;
- select "Regenerate Storage and Mapping" from the diagram shortcut menu.

If you encounter any problems with this, feel free to contact us.

Re: No compatible provider found (EF6)

Posted: Fri 07 Mar 2014 14:21
by Wired
I tried to open the EDMX generated by the SQL provider, as you instructed. However, it seems SqlClient is required for that:

SSDL parsing failed at line #306 with message: 'Provider System.Data.SqlClient not found.'
Warning! The error means that a part of the model cannot be read. If you save model after this, the unrecognized XML will be lost. It is strongly recommended to create a backup copy of the model to be able to restore it to the original state if needed.


(line number 306 refers to the first property in the first entity type inside the SSDL).

I then went ahead and tried to open the EDMX generated with dotConnect for Oracle instead, but again, was stopped dead in my tracks:

MSL parsing failed: The attribute 'Name' of tag 'EntitySetMapping' has a unexpected value 'ADRESSE' at line #3927.
Warning! The error means that a part of the model cannot be read. If you save model after this, the unrecognized XML will be lost. It is strongly recommended to create a backup copy of the model to be able to restore it to the original state if needed.


The offending code is

Code: Select all

          <EntitySetMapping Name="ADRESSE">
            <EntityTypeMapping TypeName="ProductName.Data.Administration.ADRESSE">
              <MappingFragment StoreEntitySet="ADRESSE">
                <ScalarProperty Name="Z_AD" ColumnName="Z_AD" />
                <ScalarProperty Name="STRASSE" ColumnName="STRASSE" />
                <ScalarProperty Name="PLZ" ColumnName="PLZ" />
                <ScalarProperty Name="ORT" ColumnName="ORT" />
                <ScalarProperty Name="POSTFACH" ColumnName="POSTFACH" />
                <ScalarProperty Name="POSTFACHPLZ" ColumnName="POSTFACHPLZ" />
                <ScalarProperty Name="BUNDESLAND" ColumnName="BUNDESLAND" />
                <ScalarProperty Name="STAAT" ColumnName="STAAT" />
                <ScalarProperty Name="TELEFON1" ColumnName="TELEFON1" />
                <ScalarProperty Name="TELEFON2" ColumnName="TELEFON2" />
                <ScalarProperty Name="MOBIL" ColumnName="MOBIL" />
                <ScalarProperty Name="FAX" ColumnName="FAX" />
                <ScalarProperty Name="EMAIL" ColumnName="EMAIL" />
                <ScalarProperty Name="WEB" ColumnName="WEB" />
                <ScalarProperty Name="IBEMERKUNGAD" ColumnName="IBEMERKUNGAD" />
                <ScalarProperty Name="GEMEINDEID" ColumnName="GEMEINDEID" />
                <ScalarProperty Name="LATLON" ColumnName="LATLON" />
                <ScalarProperty Name="ZUSATZ" ColumnName="ZUSATZ" />
                <ScalarProperty Name="ILAGE" ColumnName="ILAGE" />
              </MappingFragment>
            </EntityTypeMapping>
          </EntitySetMapping>
Not sure what the deal is here. The model is actually loaded but the error message hints at parts missing from the EDMX.

Regarding number types, I checked with SQLDeveloper what the actual column types are, here's part of the DDL export:

Code: Select all

  CREATE TABLE "C##VIVAMBULANT"."DB_INFO" 
   (	"Z_DB" NUMBER(10,0), 
	"TYP" NUMBER(10,0), 
	"MODUL" NUMBER(10,0), 
	"NAME" VARCHAR2(250 BYTE), 
	"USERNAME" VARCHAR2(250 BYTE), 
	"PASSWORT" VARCHAR2(250 BYTE), 
	"GUIDDB" VARCHAR2(250 BYTE), 
	"BEREICHE" CLOB, 
	"BEREICHEPD" CLOB, 
	"CONSTR" CLOB
   )
That is, number and precision are explicitly given, so why does the SSDL generated by dotConnect refer to these as being of type int64 I have to wonder?

Re: No compatible provider found (EF6)

Posted: Tue 11 Mar 2014 13:58
by MariiaI
The default data type mapping is available here.
Please try performing the following steps:
- create new connection in the Server Explorer and click "Advanced" tab;
- find there the "Number Mappings" property;
- add the necessary ones, for example: (INTEGER,1,10,System.Int32)
- save the changes;
- add a new ADO.NET Entity Data Model with this connection.

Also, we are sending you a small test project to the e-mail address you have provided in your forum profile. Please check that the letter is not blocked by your mail filter. Please test it and tell us if this helps.

JIC: New "Number Mappings" rules are added to the default (mentioned above). Thus, you should be sure that your mapping rules overlap/complement the default rules on the necessary conditions.
SSDL parsing failed at line #15 with message: 'Provider System.Data.SqlClient not found.'
Warning! The error means that a part of the model cannot be read. If you save model after this, the unrecognized XML will be lost. It is strongly recommended to create a backup copy of the model to be able to restore it to the original state if needed.
This error means that Entity Developer, which is bundled with dotConnect for Oracle, doesn't provide support for SQL Server. For this case, please install Entity Developer for Entity Framework/Professional additionally:
http://www.devart.com/entitydeveloper/download.html
http://www.devart.com/entitydeveloper/editions.html