Entity Framework 6 - Npgsql - connection string error

淺唱寂寞╮ 提交于 2019-12-07 15:21:28

Looks like the "EntityFramework6.Npgsql" nuget package in the current version has incorrectly defined dependencies. It lists "Npgsql (>= 3.1.0)" as a dependency but it actually requires Npgsql in version 3.1.2 or higher.

So the fix is simple - just update the Npgsql package to the latest version. "Update-Package Npgsql" should do the trick.

And as for the context constructor with a string parameter - you got a weird exception because that constructor expects you to pass the name of the connection string from your config file. You should use it like this:

using (var db = new PlayerContext("PlayerContext"))
{ }
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!