Tuesday, March 19, 2024
HomeProductsADO.NET Data ProvidersEntity Framework 6 Support for Oracle, MySQL, PostgreSQL, SQLite, DB2 and Salesforce

Entity Framework 6 Support for Oracle, MySQL, PostgreSQL, SQLite, DB2 and Salesforce

Article was updated on December 5th, 2013

Entity Framework 6 Alpha 2 support is implemented in Devart ADO.NET providers: dotConnect for Oracle, dotConnect for MySQL, dotConnect for PostgreSQL, dotConnect for SQLite, dotConnect for DB2 and dotConnect for Salesforce. You need to download the corresponding Entity Framework NuGet package to use it in your applications. You can read about Entity Framework 6 features in the corresponding MSDN articles.

New Assemblies

In order to support Entity Framework 6, we have included new assemblies compiled under .NET Framework 4.0 to the installation packages of our providers. We have added the revision number “6” to the assembly versions to easily distinguish them from the corresponding Entity Framework v4/v5 assemblies.

I.e., if a Devart.Data.Xxx.Entity.dll assembly for Entity Framework v4/v5 has the “7.4.147.0” version number, the corresponding Entity Framework 6 assembly will have the “7.4.147.6” version.

Entity Framework 6 support assemblies are installed to the GAC and to the provider installation folder (by default to %Program Files%\Devart\dotConnect\Xxx\Entity\EF6 where Xxx can be ‘Oracle’, ‘MySQL’, ‘PostgreSQL’, ‘SQLite’, ‘DB2’ or ‘Salesforce’).

Code-First Migrations

With the release of Entity Framework 6 there is no more need to place Code-First Migrations functionality in a separate assembly, so there are no more Devart.Data.Xxx.Entity.Migrations.dll assemblies. Code-First Migrations functionality is integrated to the main Devart.Data.Xxx.Entity.dll Entity Framework assembly.

Entity Framework Spatials Support

Entity Framework Spatials are currently supported only in Devart dotConnect for Oracle.

Spatials support was first introduced in Entity Framework 5 on .NET Framework 4.5. Now, with the release of Entity Framework 6, we have supported Entity Framework Spatials for .NET Framework 4.0 too.

There is also an additional Devart.Data.Oracle.Entity.SharpMap.dll assembly, compiled for .NET Framework 4.0, to support the SharpMap library.

For more details on Spatials support see the “Using Entity Framework Spatials with Oracle Spatial and SharpMap” blog article.

Provider Registration

Entity Framework provider registration has been changed in Entity Framework 6. In earlier versions of Entity Framework it’s enough to register DbProviderFactory in the machine.config or application config file. Now you need to perform some additional actions. You can register an Entity Framework provider in two ways: using config file registration or сode-based registration.

Config File Registration

Registration in entityFramework Section

After you install the EntityFramework 6 NuGet package, the following lines will be added to your application config file:

<?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>
    <defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />
  </entityFramework>
</configuration>

You need to remove the defaultConnectionFactory registration add to add the Entity Framework provider registration by registering it in the entityFramework section. Here is the example, registering Devart dotConnect for Oracle:

<?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=7.4.147.6, Culture=neutral, PublicKeyToken=09af7300eec23701" />        
    </providers>  
  </entityFramework>
</configuration>

Note: Don’t forget to replace ‘7.4.147.6’ with the actual Entity Framework provider assembly version.

DbProviderFactory Registration

When our provider is installed, it automatically places provider registration record to the DbProviderFactories section in the global machine.config file, and there is no need to duplicate it in the local application config file, while the application is developed and tested locally. However, to deploy your application, you need to register the Entity Framework provider in the DbProviderFactories section. Here is an example, registering Devart dotConnect for Oracle:

<?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=7.4.147.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=7.4.147.0, Culture=neutral, PublicKeyToken=09af7300eec23701" />
    </DbProviderFactories>
  </system.data>
</configuration>

Note: Don’t forget to replace ‘7.4.147.0’ with the actual provider assembly version.

Registration Examples

The registration is similar for other dotConnect providers. Here is an example, registering all our Entity Framework providers – for Oracle, MySQL, PostgreSQL, SQLite, DB2 and Salesforce:

<?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=7.4.147.6, Culture=neutral, PublicKeyToken=09af7300eec23701" />
      <provider invariantName="Devart.Data.MySql" type="Devart.Data.MySql.Entity.MySqlEntityProviderServices, Devart.Data.MySql.Entity, Version=7.3.147.6, Culture=neutral, PublicKeyToken=09af7300eec23701" />
      <provider invariantName="Devart.Data.PostgreSql" type="Devart.Data.PostgreSql.Entity.PgSqlEntityProviderServices, Devart.Data.PostgreSql.Entity, Version=6.3.147.6, Culture=neutral, PublicKeyToken=09af7300eec23701" />
      <provider invariantName="Devart.Data.SQLite" type="Devart.Data.SQLite.Entity.SQLiteEntityProviderServices, Devart.Data.SQLite.Entity, Version=4.3.147.6, Culture=neutral, PublicKeyToken=09af7300eec23701" />
      <provider invariantName="Devart.Data.DB2" type="Devart.Data.DB2.Entity.DB2EntityProviderServices, Devart.Data.DB2.Entity, Version=1.6.146.6, Culture=neutral, PublicKeyToken=09af7300eec23701" />
      <provider invariantName="Devart.Data.Salesforce" type="Devart.Data.Salesforce.Entity.SalesforceEntityProviderServices, Devart.Data.Salesforce.Entity, Version=2.1.35.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=7.4.147.0, Culture=neutral, PublicKeyToken=09af7300eec23701" />
      <remove invariant="Devart.Data.MySql" />
      <add name="dotConnect for MySQL" invariant="Devart.Data.MySql" description="Devart dotConnect for MySQL"
       type="Devart.Data.MySql.MySqlProviderFactory, Devart.Data.MySql, Version=7.3.147.0, Culture=neutral, PublicKeyToken=09af7300eec23701" />
      <remove invariant="Devart.Data.PostgreSql" />
      <add name="dotConnect for PostgreSQL" invariant="Devart.Data.PostgreSql" description="Devart dotConnect for PostgreSQL"
       type="Devart.Data.PostgreSql.PgSqlProviderFactory, Devart.Data.PostgreSql, Version=6.3.147.0, Culture=neutral, PublicKeyToken=09af7300eec23701" />
      <remove invariant="Devart.Data.SQLite" />
      <add name="dotConnect for SQLite" invariant="Devart.Data.SQLite" description="Devart dotConnect for SQLite"
       type="Devart.Data.SQLite.SQLiteProviderFactory, Devart.Data.SQLite, Version=4.3.147.0, Culture=neutral, PublicKeyToken=09af7300eec23701" />
      <remove invariant="Devart.Data.DB2" />
      <add name="dotConnect for DB2" invariant="Devart.Data.DB2" description="Devart dotConnect for DB2"
       type="Devart.Data.DB2.DB2ProviderFactory, Devart.Data.DB2, Version=1.6.146.0, Culture=neutral, PublicKeyToken=09af7300eec23701" />
      <remove invariant="Devart.Data.Salesforce" />
      <add name="dotConnect for Salesforce" invariant="Devart.Data.Salesforce" description="Devart dotConnect for Salesforce"
       type="Devart.Data.Salesforce.SalesforceProviderFactory, Devart.Data.Salesforce, Version=2.1.35.0, Culture=neutral, PublicKeyToken=09af7300eec23701" />
    </DbProviderFactories>
  </system.data>
</configuration>

Registration of Entity Framework Code-First Migrations

To register migration SQL generator for Code-First Migrations, use the SetSqlGenerator method of the DbMigrationsConfiguration descendant for Entity Framework 6.

internal sealed class Configuration : DbMigrationsConfiguration {
    public Configuration() {
        AutomaticMigrationsEnabled = false; 
        this.SetSqlGenerator(OracleConnectionInfo.InvariantName, new OracleEntityMigrationSqlGenerator());
    }
    // ...
}

Code-based Registration

Entity Framework provider can be registered with the special DbConfigurationType attribute or with the static SetConfiguration method of the new DbConfiguration class. You need to path a specially configured DbConfiguration descendant to this method.

New Registration Classes

To ease code-based registration, we have included new DbConfiguration descendants to our Entity Framework providers:

ProviderAssemblyClass Name

Devart dotConnect for Oracle Devart.Data.Oracle.Entity.dll Devart.Data.Oracle.Entity.OracleEntityProviderServicesConfiguration
Devart dotConnect for MySQL Devart.Data.MySql.Entity.dll Devart.Data.MySql.Entity.MySqlEntityProviderServicesConfiguration
Devart dotConnect for PostgreSQL Devart.Data.PostgreSql.Entity.dll Devart.Data.PostgreSql.Entity.PgSqlEntityProviderServicesConfiguration
Devart dotConnect for SQLite Devart.Data.SQLite.Entity.dll Devart.Data.SQLite.Entity.SQLiteEntityProviderServicesConfiguration
Devart dotConnect for DB2 Devart.Data.DB2.Entity.dll Devart.Data.DB2.Entity.DB2EntityProviderServicesConfiguration
Devart dotConnect for Salesforce Devart.Data.Salesforce.Entity.dll Devart.Data.Salesforce.Entity.SalesforceEntityProviderServicesConfiguration

Code-based Registration Examples

dotConnect for Oracle Entity Framework provider registration with the DbConfigurationType attribute (can be used for DbContext only):

  [DbConfigurationType(typeof(Devart.Data.Oracle.Entity.OracleEntityProviderServicesConfiguration))]
  public class MyContext : DbContext {

    // ...
  }

dotConnect for Oracle Entity Framework provider registration with the static SetConfiguration method of the new DbConfiguration class (can be used for both DbContext and ObjectContext):

  public class MyContext: ObjectContext {

    static MyContext() {

      DbConfiguration.SetConfiguration(new Devart.Data.Oracle.Entity.OracleEntityProviderServicesConfiguration());
    }

    // ...
  }

If you have installed our Entity Framework provider, machine.config already contain the provider registration record in the DbProviderFactories section, and you don’t need to duplicate it in the local application config file while the application is developed and tested locally. You can use only code-based registration during development time.

However, when you deploy your project, you need to register the Entity Framework provider in the DbProviderFactories of the application config file, like it is described above in the DbProviderFactory Registration section.

Migrating Projects from Entity Framework v4/v5

To migrate your project from Entity Framework v4/v5 to Entity Framework v6 perform the following steps:

  1. Install EntityFramework 6. For example, you can do it with the following command in Package Manager Console:
    Install-Package EntityFramework -Pre
  2. Remove references to old assemblies, specific to Entity Framework v4/v5 from the project:
    • System.Data.Entity.dll
    • Devart.Data.Xxx.Entity.dll
    • Devart.Data.Xxx.Entity.Migrations.dll (for Oracle, MySQL, PostgreSQL, or SQLite)
    • Devart.Data.Oracle.Entity.SharpMap.dll (for Oracle)
  3. Add references to new, Entity Framework 6 compatible, assemblies to the project:
    • Devart.Data.Xxx.Entity.dll
    • Devart.Data.Oracle.Entity.SharpMap.dll (for Oracle if you use Oracle Spatials and SharpMap)
  4. Register Entity Framework provider with one of the ways described above

Entity Developer

For Entity Developer users migration is very simple – just change Entity Framework Version option to “Entity Framework 6” in Model Settings. After this close the model and open it in Entity Developer again. Entity Developer will generate valid code, compatible with Entity Framework 6.

Currently if you use standalone Entity Developer (not the one integrated to the Visual Studio), you need to manually add the EntityFramework.dll assembly to the GAC of .NET Framework 4.0 (4.5) or to place this assembly to the directory where Entity Developer is installed. This is not required, however some Entity Developer features may not work correctly for Entity Framework 6 models without it. We plan to overcome this limitation in future releases.

Code-First or Entity Data Model Designer

See Microsoft recommendations on migration to Entity Framework 6.

Obsolete Workarounds

Entity Framework 6 introduces custom conventions including lightweight conventions. This makes the following Devart dotConnect for Oracle properties obsolete and not recommended to use:

  • config.CodeFirstOptions.UseNonUnicodeStrings
  • config.CodeFirstOptions.UseNonLobStrings
  • config.CodeFirstOptions.UseDateTimeAsDate

These are settings used for workarounds, related to configuring property mapping when the explicit definition of mapping is incomplete.

Here are the examples how to replace these options in a way, recommended in Entity Framework 6.

Using Non-unicode Strings

A simple lightweight convention can be used instead of the config.CodeFirstOptions.UseNonUnicodeStrings property.

  public class MyContext : DbContext {

    protected override void OnModelCreating(DbModelBuilder modelBuilder) {

      modelBuilder
        .Properties()
        .Where(p => p.PropertyType == typeof(string))
        .Configure(p => p.IsUnicode(false));
    }

    // ...
  }

This convention makes all the string properties non-unicode.

Using Non-LOB Strings

Instead of the config.CodeFirstOptions.UseNonLobStrings property, you can use the following lightweight convention.

  public class MyContext : DbContext {

    protected override void OnModelCreating(DbModelBuilder modelBuilder) {

      modelBuilder
        .Properties()
        .Where(p => p.PropertyType == typeof(string) && 
                    p.GetCustomAttributes(typeof(MaxLengthAttribute), false).Length == 0)
        .Configure(p => p.HasMaxLength(2000));
    }

    // ...
  }

This convention sets MaxLength to 2000 characters for all string properties, which don’t have MaxLength set explicitly with the MaxLengthAttribute attribute.

Using DATE fields instead of TIMESTAMP

You can use the following simple lightweight convention instead of the config.CodeFirstOptions.UseDateTimeAsDate property.

  public class MyContext : DbContext {

    protected override void OnModelCreating(DbModelBuilder modelBuilder) {

      modelBuilder
        .Properties()
        .Where(p => p.PropertyType == typeof(DateTime))
        .Configure(p => p.HasPrecision(0));
    }

    // ...
  }

This convention sets zero precision for all DateTime properties. This makes Oracle use DATE type instead of TIMESTAMP(7) because DATE does not store fractions of seconds.

Samples

Here you can download the archive with the Entity Framework 6 version of Code-First samples CrmDemo.EF6CodeFirst_.zip. In this archive you can find the full version of the above examples that use EF Code-First for each ADO.NET provider:

  • Devart dotConnect for Oracle
  • Devart dotConnect for MySQL
  • Devart dotConnect for PostgreSQL
  • Devart dotConnect for SQLite
  • Devart dotConnect for DB2
  • as well as for standard Microsoft .NET Framework Data Provider for SQL Server (SqlClient)

Conclusion

We are glad to provide the new Entity Framework provider functionality – support for Entity Framework 6 – to our users. We hope that you will not have any difficulties migrating to Entity Framework 6. In any case, we are glad to help our users if they have any troubles with migration. As for our future plans on Entity Framework provider development, they are determined largely by your feedback and suggestions via product feedback pages, forum and UserVoice.

This article was updated on December 5th, 2013. The information regarding working with Entity Framework 6 and dotConnect for DB2 was added.
Update from January 4th, 2017: Please note that Entity Framework related assemblies in dotConnect data providers were renamed, and their versioning was changed. See more details here.
RELATED ARTICLES

24 COMMENTS

  1. I’ll immediately snatch your rss feed as I can’t in finding your e-mail subscription hyperlink or newsletter service. Do you’ve any? Kindly permit me understand so that I could subscribe. Thanks.

  2. An option of subscribing via e-mail has been added, on the top of the page on the right, you can find an e-mail subscription box.

  3. I’m migration an asp.net mvc application using devart for mysql from EF5 to EF6 RC1.
    I followed this post to do that and I got an error.
    When I try to register the provider in the config file, it complains that is an unknown tag.

    The only way I can get it to work is to remove tag from the config file and keep SetSqlGenerator() in the constructor of the Configuration class of EF Migrations.

    Am I doing something wrong here?

    Regards,
    Steven.

  4. Registration of migrationSqlGenerator via *.config was available in the pre-release versions of EF6, but EF6 RTM doesn’t support this. As a workaround, please specify migration SQL generator with the SetSqlGenerator method of the DbMigrationsConfiguration descendant for Entity Framework 6.

  5. […] You can find the updated version of the samples for Entity Framework 6 in this blog article: Entity Framework 6 Support for Oracle, MySQL, PostgreSQL, SQLite and Salesforce. […]

  6. Hello, We .net developers (team – 3 nos) who have developed several applications using entityframework. We are interested in buying your product for Entity Framework 6 oracle support.

    The question we have is what is the license convering each of the five editions (Developer, Professional, Standard, Mobile, and Express ) in terms of how many systems (development machine/Server) can we install each of the editions.

    Your response will help our decision making.

    Thank you.

    Ibrahim Shaib.

  7. If you see an error “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. …” while trying to generate an .edmx from Database using EF 6, make sure that you’ve built the project that contains your .edmx *before* trying to generate the .edmx in the current configuration (Release|Any CPU, Debug|Any CPU, etc).

  8. Does the express edition support Entity Framework 6 out of the box? I can’t seem to find the Devart.Data.Oracle.Entity assembly anywhere?

  9. Hi, I’m trying to use code first and I get an error, enclose the code. Thank you.
    ———————————————————————————-
    public class MyBdContext : DbContext
    {
    public MyBdContext() : base(“DemoEF6”) { }

    public MyBdContext(DbConnection connection): base(connection, true)
    {
    }

    public DbSet Personas { get; set; }
    }
    ———————————————————————————-

    ——————————————————————————————-

    [Table(“persona”, Schema = “public”)]
    public class Persona
    {
    [Key]
    [Column(“idpersona”)]
    [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
    public int IdPersona { get; set; }
    [Column(“apellidos”)]
    public string Apellidos { get; set; }
    [Column(“nombres”)]
    public string Nombres { get; set; }
    }

  10. An exception of type ‘System.InvalidOperationException’ occurred in mscorlib.dll but was not handled in user code

    Additional information: The ‘Instance’ member of the Entity Framework provider type ‘Devart.Data.PostgreSql.Entity.PgSqlEntityProviderServices, Devart.Data.PostgreSql.Entity, Version=7.3.135.0, Culture=neutral, PublicKeyToken=09af7300eec23701’ did not return an object that inherits from ‘System.Data.Entity.Core.Common.DbProviderServices’. Entity Framework providers must inherit from this class and the ‘Instance’ member must return the singleton instance of the provider. This may be because the provider does not support Entity Framework 6 or later; see http://go.microsoft.com/fwlink/?LinkId=260882 for more information.

  11. In PostgreSQL example, MyDbContextSeeder is never called.
    How can we buy a product with not running sample ?

  12. to Ibrahim Shaib:
    The dotConnect product is licensed for developers (not for a workstation or a server). Every licensed developer is entitled to install dotConnect for Oracle on any number of workstations provided the product is used only by him for sole purposes of development, testing, and deployment.

    to Seva Zaslavsky:
    Thank you for your note. We will add this information to our EF tutorial.
    JIC: we recommend using Entity Developer (Devart Entity Model, *.edml) instead of EDM Designer (ADO.NET Entity Data Model, *.edmx) because it is adjusted for working with Oracle and has an advanced functionality: https://www.devart.com/entitydeveloper/ed-vs-edm.html . Additionally, Entity Developer adds registration of EF6-provider in app.config automatically.

    to Ron Sheppard:
    The Entity Framework support is available only in the Professional and Developer editions of dotConnect for Oracle: https://www.devart.com/dotconnect/oracle/editions.html .

    to Carlos:
    Looks like you did not update the provider version in \CrmDemo.EFCodeFirst.PostgreSql\app.config . You can check your current version via the Tools > PostgreSQL > About menu. Please note that the revision number of provider in the entityFramework section is *.6 (7.3.135.6) but it should be *.0 (7.3.135.0) in DbProviderFactories.

    to David Penn:
    Please refer to Seva Zaslavskys note. You should rebuild your project after adding the *.config entries and before running EDM Wizard.
    JIC: we recommend using Entity Developer (Devart Entity Model, *.edml) instead of EDM Designer (ADO.NET Entity Data Model, *.edmx) because it is adjusted for working with Oracle and has an advanced functionality: https://www.devart.com/entitydeveloper/ed-vs-edm.html . Additionally, Entity Developer adds registration of EF6-provider in app.config automatically.

  13. to Daniel Lucazeau:
    Please compare the original \CrmDemo.EFCodeFirst\CrmDemo.EFCodeFirst.PostgreSql\MyPgSqlContext.cs file with the one in your modified project. You have changed
    System.Data.Entity.Database.SetInitializer(new MyDbContextDropCreateDatabaseAlways());
    to
    Database.SetInitializer(new MyDbContextDropCreateDatabaseAlways());
    That is exactly the reason of the issue you have encountered.

  14. How do I do the Code-based Registration when it comes to Postgres?
    There is only one example with Oracle, and I coudn’t find a way to replicate it with dotConnect for Postgres.

    I tried this:

    [DbConfigurationType(typeof(Devart.Data.PostgreSql.Entity.PgSqlEntityProviderServices))]
    public class MyContext : DbContext {

    // …
    }

    and then: (this one does not compile)

    public class MyContext: ObjectContext {

    static MyContext() {

    DbConfiguration.SetConfiguration(new Devart.Data.PostgreSql.Entity.PgSqlEntityProviderServices());
    }

    // …
    }

    How do I do that? I really need it…

  15. to Jose Carlos:
    Please use
    [DbConfigurationType(typeof(Devart.Data.PostgreSql.Entity.PgSqlEntityProviderServicesConfiguration))]
    instead of
    [DbConfigurationType(typeof(Devart.Data.PostgreSql.Entity.PgSqlEntityProviderServices))]

    If this doesn’t help, specify the exact text of the error you have encountered. A small test project will be appreciated.

  16. Hi,
    I installed the latest version of dotConnect for SQLite
    I downloaded your demo code and updated EF to 6.1.3
    I updated the version number in the app.config as below

    I got this error
    “Additional information: The ‘Instance’ member of the Entity Framework provider type ‘Devart.Data.SQLite.Entity.SQLiteEntityProviderServices, Devart.Data.SQLite.Entity, Version=5.3.563.0, Culture=neutral, PublicKeyToken=09af7300eec23701’ did not return an object that inherits from ‘System.Data.Entity.Core.Common.DbProviderServices’. Entity Framework providers must inherit from this class and the ‘Instance’ member must return the singleton instance of the provider. This may be because the provider does not support Entity Framework 6 or later; see http://go.microsoft.com/fwlink/?LinkId=260882 for more information.”

    Please help, I want to buy your libraries to create a database agnostic application that works with Sql Server, SQLite and Oracle.

  17. to Armando:

    Please check your app.config, it should contain the following entries:

    <?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" />
    </configSections>
    <entityFramework>
    <providers>
    <provider invariantName="Devart.Data.SQLite" type="Devart.Data.SQLite.Entity.SQLiteEntityProviderServices, Devart.Data.SQLite.Entity, Version=5.3.563.6, Culture=neutral, PublicKeyToken=09af7300eec23701" />=09af7300eec23701" />
    </providers>
    </entityFramework>
    <system.data>
    <DbProviderFactories>
    <remove invariant="Devart.Data.SQLite" />
    <add name="dotConnect for SQLite" invariant="Devart.Data.SQLite" description="Devart dotConnect for SQLite" type="Devart.Data.SQLite.SQLiteProviderFactory, Devart.Data.SQLite, Version=5.3.563.0, Culture=neutral, PublicKeyToken=09af7300eec23701" />
    </DbProviderFactories>
    </system.data>
    </configuration>

    Replace 5.3.563 here with your current version of dotConnect for SQLite. Please note that the revision number of provider in the entityFramework section is 6 (5.3.563.6) but it should be 0 (5.3.563.0) in DbProviderFactories.

  18. Hi DevartTeam,
    our software team may integrate your SQLite provider in our software. Therefore I started to investigate you product. I’ve downloaded the latest provider for SQLite (in my case it’s Devart.Data.SQLite.Entity Version=5.3.592.0) and tried to execute your CrmDemo.EFCodeFirst example using EF6 (6.0.1). Now when I execute the demo I experience the same problem as Armando does:

    The ‘Instance’ member of the Entity Framework provider type ‘Devart.Data.SQLite.Entity.SQLiteEntityProviderServices, Devart.Data.SQLite.Entity, Version=5.3.592.0, Culture=neutral, PublicKeyToken=09af7300eec23701’ did not return an object that inherits from ‘System.Data.Entity.Core.Common.DbProviderServices’. Entity Framework providers must inherit from this class and the ‘Instance’ member must return the singleton instance of the provider. This may be because the provider does not support Entity Framework 6 or later; see http://go.microsoft.com/fwlink/?LinkId=260882 for more information.

    Do you have any solution or advice how I can solve my problem.

    Kind regards,

    Rudi.

  19. to Rudi

    We are sorry, because of some technical troubles, some recent comments were not displayed in our blog. Please see our answer to Armando above your comment.

  20. Hi DevartTeam,
    I downloaded “dotConnect for PostgreSQL 7.4 Professional Trial” from your website.
    I get the following error when I going to add ADO.NET in my project (Console Application, in VS 2013, I d).
    “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. …”
    I am using Entity framework 6, installed through “Package Manager Console” using command “Install-Package EntityFramework -Version 6.0.0″… And install “dotConnect Express for PostgreSQL” from NuGet Packages. And also Rebuild before setting the app.config file.
    My app.config is:

    Please Help me..

  21. 1. We recommend you to use Entity Developer (the Devart Entity Model item, *.edml) instead of EDM Designer (the ADO.NET Entity Data Model item, *.edmx) because it is adjusted for working with dotConnect providers and has an advanced functionality: https://www.devart.com/entitydeveloper/ed-vs-edm.html. Additionally, Entity Developer adds registration of EF6 provider in app.config automatically and offers designer (Database First / Model First) for EF Core.

    2. In case of using EDM Designer (the ADO.NET Entity Data Model item, *.edmx), the *.config entry should be:

    Replace 7.11.1278 here with your current version of dotConnect for PostgreSQL.

Comments are closed.

Whitepaper

Social

Topics

Products