如何将PostgreSql与EntityFramework 6.0.2集成?

编程入门 行业动态 更新时间:2024-10-25 20:27:21
本文介绍了如何将PostgreSql与EntityFramework 6.0.2集成?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我收到以下错误

实体框架提供程序的Instance成员键入'Npgsql.NpgsqlServices, Npgsql,Version = 2.0.14.2,Culture = neutral, PublicKeyToken = 5d8b90d52f46fda7'没有返回从'System.Data.Entity.Core.Common.DbProviderServices'继承的对象。 实体框架提供者必须从此类继承,'Instance'成员必须返回提供者的单例实例。 这可能是因为提供者不支持Entity Framework 6 或更高版本;请参阅 go.microsoft/fwlink/?LinkId=260882&hl=zh_CN 更多信息。

The 'Instance' member of the Entity Framework provider type 'Npgsql.NpgsqlServices, Npgsql, Version=2.0.14.2, Culture=neutral, PublicKeyToken=5d8b90d52f46fda7' 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 go.microsoft/fwlink/?LinkId=260882 for more information.

任何人都可以帮助我

这里是我的App.Config文件

here is my App.Config File

<?xml version="1.0" encoding="utf-8"?> <configuration> <configSections> <!-- For more information on Entity Framework configuration, visit go.microsoft/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> <connectionStrings> <add name="CacsLocal" connectionString="Server=localhost;Database=Kappa;User Id=postgres; Password=xyz;" providerName="Npgsql" /> <add name=" CacsCentral" connectionString="Server=localhost;Database=KPT1;User Id=postgres; Password=insane1234;" providerName="Npgsql" /> </connectionStrings> <entityFramework> <defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" /> <providers> <provider invariantName="Npgsql" type="Npgsql.NpgsqlServices, Npgsql" /> <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer"></provider> </providers> </entityFramework> <system.data> <DbProviderFactories> <add name="Npgsql Data Provider" invariant="Npgsql" description="Data Provider for PostgreSQL" type="Npgsql.NpgsqlFactory, Npgsql" /> </DbProviderFactories> </system.data> <startup> <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" /> </startup> </configuration>

我有Npgsql2版本2.0.14.2 实体框架6.0.2

I have Npgsql2 version 2.0.14.2 Entity Framework 6.0.2

所有包都通过包管理器通过以下命令安装

All the packages are installed through Package Manager by following command

Install-Package Npgsql -Pre Install-Package EntityFramework -Pre

谢谢

推荐答案

查看此问题:实体框架6与Npgsql

它有指针让它工作。我希望它有帮助。

It has the pointers to get it working. I hope it helps.

更多推荐

如何将PostgreSql与EntityFramework 6.0.2集成?

本文发布于:2023-11-01 12:17:44,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1549311.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:如何将   PostgreSql   EntityFramework

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!