Last active
May 12, 2023 18:39
-
-
Save raspi/8927531 to your computer and use it in GitHub Desktop.
Web.config example Entity Framework 6 & Npgsql.EntityFramework (PostgreSQL)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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, Culture=neutral" requirePermission="false" /> | |
</configSections> | |
<system.web> | |
<compilation debug="true" targetFramework="4.5"> | |
<assemblies> | |
<add assembly="System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /> | |
</assemblies> | |
</compilation> | |
<pages> | |
<namespaces> | |
<add namespace="System.Web.Mvc" /> | |
<add namespace="System.Web.Mvc.Html" /> | |
</namespaces> | |
</pages> | |
</system.web> | |
<system.webServer> | |
<modules runAllManagedModulesForAllRequests="true" /> | |
</system.webServer> | |
<system.data> | |
<DbProviderFactories> | |
<add name="Npgsql Data Provider" | |
invariant="Npgsql" | |
description ="Data Provider for PostgreSQL" | |
type="Npgsql.NpgsqlFactory, Npgsql" /> | |
</DbProviderFactories> | |
</system.data> | |
<connectionStrings> | |
<add name="Context" | |
connectionString="Server=127.0.0.1;port=5432;Database=test;User Id=test;Password=test1234;" | |
providerName="Npgsql" /> | |
</connectionStrings> | |
<entityFramework> | |
<providers> | |
<provider invariantName="Npgsql" | |
type="Npgsql.NpgsqlServices, Npgsql.EntityFramework" /> | |
</providers> | |
</entityFramework> | |
</configuration> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I have used the order 1-system.data,2-ConnectionString,3-entityFrameWork and solve my problem which gives message "ArgumentException: The ADO.NET provider with invariant name 'Npgsql' is either not registered in the machine or application config file, or could not be loaded. See the inner exception for details." Thanks