Page 1 of 1

PostgreSql Entity Provider

Posted: Thu 17 Dec 2015 22:57
by SteelTermite
I downloaded the latest 30 day trial and installed. Created an ASP.Net webforms application for .Net 4.5, installed the entity framework via nugget, modified the entityFramework section for the postresql provider version 7.4.543.0, compiled and attempted to add the ADO.Net Entity Data Model - database connection looked good and test successfully, and then I get an error "Your project references the latest version of the Entity Framework; however, an Entity Framework data provide compatible with this version could not be found for your data connection. If you have already installed a compatable provider, ensure ........

There must be a step/something I am missing??? but what??? any assistance is appreciated

- my web.config looks like:

<?xml version="1.0" encoding="utf-8"?>
<!--
For more information on how to configure your ASP.NET application, please visit
http://go.microsoft.com/fwlink/?LinkId=169433
-->
<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="DefaultConnection" providerName="System.Data.SqlClient" connectionString="Data Source=(LocalDb)\v11.0;Initial Catalog=aspnet-EFTest_8-20151217175503;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|\aspnet-EFTest_8-20151217175503.mdf" />
</connectionStrings>
<system.web>
<compilation debug="true" targetFramework="4.5" />
<httpRuntime targetFramework="4.5" />
<pages>
<namespaces>
<add namespace="System.Web.Optimization" />
</namespaces>
<controls>
<add assembly="Microsoft.AspNet.Web.Optimization.WebForms" namespace="Microsoft.AspNet.Web.Optimization.WebForms" tagPrefix="webopt" />
</controls></pages>
<authentication mode="Forms">
<forms loginUrl="~/Account/Login" timeout="2880" defaultUrl="~/" />
</authentication>
<profile defaultProvider="DefaultProfileProvider">
<providers>
<add name="DefaultProfileProvider" type="System.Web.Providers.DefaultProfileProvider, System.Web.Providers, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" connectionStringName="DefaultConnection" applicationName="/" />
</providers>
</profile>
<membership defaultProvider="DefaultMembershipProvider">
<providers>
<add name="DefaultMembershipProvider" type="System.Web.Providers.DefaultMembershipProvider, System.Web.Providers, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" connectionStringName="DefaultConnection" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="false" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10" applicationName="/" />
</providers>
</membership>
<roleManager defaultProvider="DefaultRoleProvider">
<providers>
<add name="DefaultRoleProvider" type="System.Web.Providers.DefaultRoleProvider, System.Web.Providers, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" connectionStringName="DefaultConnection" applicationName="/" />
</providers>
</roleManager>
<!--
If you are deploying to a cloud environment that has multiple web server instances,
you should change session state mode from "InProc" to "Custom". In addition,
change the connection string named "DefaultConnection" to connect to an instance
of SQL Server (including SQL Azure and SQL Compact) instead of to SQL Server Express.
-->
<sessionState mode="InProc" customProvider="DefaultSessionProvider">
<providers>
<add name="DefaultSessionProvider" type="System.Web.Providers.DefaultSessionStateProvider, System.Web.Providers, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" connectionStringName="DefaultConnection" />
</providers>
</sessionState>
</system.web>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="DotNetOpenAuth.Core" publicKeyToken="2780ccd10d57b246" />
<bindingRedirect oldVersion="1.0.0.0-4.0.0.0" newVersion="4.1.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="DotNetOpenAuth.AspNet" publicKeyToken="2780ccd10d57b246" />
<bindingRedirect oldVersion="1.0.0.0-4.0.0.0" newVersion="4.1.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="EntityFramework" publicKeyToken="b77a5c561934e089" />
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
<entityFramework>
<providers>
<provider invariantName="Devart.Data.PostgreSql" type="Devart.Data.PostgreSql.Entity.PgSqlEntityProviderServices,Devart.Data.PostgreSql.Entity, Version=7.4.543.0, Culture=neutral, PublicKeyToken=09af7300eec23701"/>
</providers>
</entityFramework>
</configuration>

Re: PostgreSql Entity Provider

Posted: Fri 18 Dec 2015 10:59
by Shalex
SteelTermite wrote:<entityFramework>
<providers>
<provider invariantName="Devart.Data.PostgreSql" type="Devart.Data.PostgreSql.Entity.PgSqlEntityProviderServices,Devart.Data.PostgreSql.Entity, Version=7.4.543.0, Culture=neutral, PublicKeyToken=09af7300eec23701"/>
</providers>
</entityFramework>
Please change the version: 7.4.543.0 -> 7.4.543.6.

The full provider registration (documentation):

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, Version=7.4.543.6, 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.4.543.0, Culture=neutral, PublicKeyToken=09af7300eec23701" />
    </DbProviderFactories>
  </system.data>
</configuration>
Please note that the revision number of provider in the entityFramework section is *.6 (7.4.543.6) but it should be *.0 (7.4.543.0) in DbProviderFactories.

Re: PostgreSql Entity Provider

Posted: Fri 18 Dec 2015 13:53
by SteelTermite
I made the provider change as advised:

<provider invariantName="Devart.Data.PostgreSql" type="Devart.Data.PostgreSql.Entity.PgSqlEntityProviderServices,Devart.Data.PostgreSql.Entity, Version=7.4.543.6, Culture=neutral, PublicKeyToken=09af7300eec23701"/>

When now when I run, at the step where I select an entity framework, it gives the option to select Entity Framework 6.x (grayed out) and says no provider is available ) or I can select Entity Framework 5.0. Selecting EF 5, allows me to reach the next step of the wizard in selecting tables - but had hoped to use EF 6. Is there another setting I have wrong in the config.app - or something wrong with my install???
Thank you!

Re: PostgreSql Entity Provider

Posted: Fri 18 Dec 2015 18:24
by Shalex
Please rebuild your project after updating app.config and before running Entity Data Model Wizard.

Re: PostgreSql Entity Provider

Posted: Fri 18 Dec 2015 19:08
by SteelTermite
Thank you for the response. I rebuilt the project - however it still says EF 6 does not have a provider, but gives an option for EF 5 selection.

Re: PostgreSql Entity Provider

Posted: Fri 18 Dec 2015 19:36
by Shalex
1. You've installed EF6 via nuget, haven't you?

2. Have you added references to the following assemblies in your project?
"C:\Program Files (x86)\Devart\dotConnect\PostgreSQL\Devart.Data.dll"
"C:\Program Files (x86)\Devart\dotConnect\PostgreSQL\Devart.Data.PostgreSql.dll"
"C:\Program Files (x86)\Devart\dotConnect\PostgreSQL\Entity\EF6\Devart.Data.PostgreSql.Entity.dll"

If this doesn't help, please send us a small test project so that we can reproduce the issue in our environment.

Re: PostgreSql Entity Provider

Posted: Fri 18 Dec 2015 20:11
by SteelTermite
I logged into one of my Azure VM dev instances, and was able to work though the full processes using EF 6 against PostgreSQL using Devart provider, thus there must be something in my local development environment that is causing the issue. The test asp.net projects were the boiler plate projects that come from the project creation wizard, and then I proceeded through the steps to hook it to EF 6 via Devart. Thus this has to be an issue with my local environment - I will continue looking, if I see the problem I will post back to the forum with my finding - if I don't find anything I will reset my development environment.

Thank you for your help!