ASP vNext and PostgreSql

currently exists in some way, how to communicate with the PostgreSql database when I want to use ASP.NET vNext? I am looking for a solution that will work mainly on Linux.

EF7 now only supports MS SQL SqlLite, and Npgsql is not portable for ASP.NET vNext.

thanks

+7
c # postgresql asp.net-core entity-framework-core
source share
3 answers

Instead of EF7, you can use NHibernate with Fluent NHibernate. Npgsql also works well on ASP.NET 5 (vNext) on Linux. Here is a complete example ASP.NET vNext application with NHibernate + PostgreSQL running on an ubuntu server .

+3
source share

I am still testing this (on dnx-coreclr-win-x64.1.0.0-rc2-16177 at the moment), but they have made great progress since @bricelam answered. They now have EF7 docs , including some of CoreCLR support.

Here is part of my project.json:

 "dependencies": { "EntityFramework.Commands": "7.0.0-rc2-*", "EntityFramework.Core": "7.0.0-rc2-*", "EntityFramework.Relational": "7.0.0-rc2-*", "EntityFramework7.Npgsql": "3.1.0-rc1-2", }, "frameworks": { "dnxcore50": {} } 

You may need to add https://www.myget.org/F/npgsql-unstable/api/v3/index.json to NuGet feeds to pull this package. EDIT: now I am specifying the exact version of EntityFramework7.Npgsql": "3.1.0-rc1-2" and use only this channel in my NuGet.config: https://www.myget.org/F/aspnetrelease/api/v3/ index.json strike>

EDIT: All of this is now available at https://api.nuget.org/v3/index.json

In Startup.cs:

  public void ConfigureServices(IServiceCollection services) { services.AddEntityFramework() .AddNpgsql() .AddDbContext<YourDbContext>(options => options.UseNpgsql("your connectionString")) ; } 
+2
source share

The Npgsql community works with an EF7 provider . I am sure the code is available somewhere if you want to use it.

0
source share

All Articles