Home

Feature request: EfCore DbContext Postgres support

The EF DbContext Connection dialog currently only supports "SQL Server" or "SQLite"



Please support other options like Postgres and/or mysql. Thanks.

Comments

  • As far as I can see, there is no microsoft.entityframeworkcore.postgresql package.

    There are a number of third-party packages, but I would need to write separate code for each package. Unfortunately, this is how Entity Framework core has been designed.

    The workaround is to use another constructor. Either create a parameterless constructor or one that accept a string and then you can put the providers-specific setup into that constructor.
  • edited June 2019
    There is the "Npgsql.EntityFrameworkCore.PostgreSQL" package which is the usual choice when using efcore+postgresql because its well maintained and high quality. The package is from the npgsql project, which is the "standard" for .net db access.
    It doesnt have the "Microsoft" prefix, but it is high quality and well maintained. The core contributor roj is an MS employee and works on the EFCore project.

    So I think it would be ok to only support this package as this is literally the default package/project when using postgres data-access with ef core.

    I do understand that this takes additional effort on your side. But I think that "Postgres+EF" should not be a 2nd class citizen in the new linqpad.
    The string constructor workaround works, but it is not my favorite choice, because I do not want provider specific configuration calls/types in my DbContext.
    Our configuration is usually setup in the composition-root/startup via DI, which is cleaner imho.
  • Check out the new beta - there's now support for all of the following:

    Microsoft.EntityFrameworkCore.SqlServer
    Microsoft.EntityFrameworkCore.SQLite
    Pomelo.EntityFrameworkCore.MySql
    MySql.Data.EntityFrameworkCore
    Oracle.EntityFrameworkCore
    Npgsql.EntityFrameworkCore.PostgreSQL
  • edited August 2019
    Nice job, JoeAlbahari
    But seems SQL Server not working correctly, full connection string is fixed to: Data Source=h;Integrated Security=SSPI;app=LINQPad, and cannot connect to my server.

  • Thanks for reporting - this is now fixed.
Sign In or Register to comment.