How to do Code first development with entity framework 6

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for PostgreSQL
Post Reply
kenalex
Posts: 2
Joined: Sat 24 Sep 2016 12:30

How to do Code first development with entity framework 6

Post by kenalex » Tue 17 Jan 2017 20:53

Hi,

I have just purchased the Professional version of the dotConnect Library for Postgresql with the intentions of moving from a MSQL database to Postgresql. My existing application was developed using Code First method with entity framework 6.
IN the documentation I see an example on how to perform code first for Entity Framework Core, but no examples for Entity framework 6 .

Is there an example on using code first method with DotConnect for Postgresql and Entity framework 6 that I can follow so I can get an understanding on how to setup the config file and what assemblies to import,etc ?

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Re: How to do Code first development with entity framework 6

Post by Shalex » Thu 19 Jan 2017 13:11

Please refer to
https://www.devart.com/dotconnect/postg ... rovideref6
https://www.devart.com/dotconnect/postg ... yment.html

You are using dotConnect for PostgreSQL v7.7.819 (check via Tools > PostgreSQL > About), aren't you? In this case:

1. The required assemblies are
* Devart.Data.dll v5.0.1611.0
* Devart.Data.PostgreSql.dll v7.7.819.0
* Devart.Data.PostgreSql.EF6.dll v7.7.819.0

2. The *.config file of the application should include

Code: Select all

<?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.PostgreSql" type="Devart.Data.PostgreSql.Entity.PgSqlEntityProviderServices, Devart.Data.PostgreSql.Entity.EF6, Version=7.7.819.0, Culture=neutral, PublicKeyToken=09af7300eec23701" />
    </providers>
  </entityFramework>
  <system.data>
    <DbProviderFactories>
      <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=7.7.819.0, Culture=neutral, PublicKeyToken=09af7300eec23701" />
    </DbProviderFactories>
  </system.data>
</configuration>
Replace 7.7.819.0 here with your actual version (two times).

Does this help? If not, specify the exact text of the error and its stack trace.

Post Reply