Entity Framework Core PostgreSQL Integration

See Entity Framework Core Integration document for the basics of the EF Core integration.

EntityFrameworkCore Project Update

  • In Acme.BookStore.EntityFrameworkCore project replace package Volo.Abp.EntityFrameworkCore.SqlServer with Volo.Abp.EntityFrameworkCore.PostgreSql
  • Update to use PostgreSQL in BookStoreEntityFrameworkCoreModule
    • Replace the AbpEntityFrameworkCoreSqlServerModule with the AbpEntityFrameworkCorePostgreSqlModule
    • Replace the options.UseSqlServer() with the options.UsePostgreSql()
  • In other projects update the PostgreSQL connection string in necessary appsettings.json files

Delete Existing Migrations

Delete all existing migration files (including DbContextModelSnapshot)

postgresql-delete-initial-migrations

Regenerate Initial Migration & Update the Database

Set the correct startup project (usually a web project), Open the Package Manager Console (Tools -> Nuget Package Manager -> Package Manager Console), select the Acme.BookStore.EntityFrameworkCore.DbMigrations as the Default project and execute the following command:

Run Add-Migration command.

PM> Add-Migration Initial

Then execute the Update-Database command to update the database schema:

PM> Update-Database

postgresql-update-database

Contributors


Last updated: September 03, 2019 Edit this page on GitHub

Was this page helpful?

Please make a selection.

To help us improve, please share your reason for the negative feedback in the field below.

Please enter a note.

Thank you for your valuable feedback!

Please note that although we cannot respond to feedback, our team will use your comments to improve the experience.

In this document
Community Talks

Real World Problems and Solutions with AI

27 Feb, 17:00
Online
Watch the Event
Boost Your Development
ABP Live Training
Packages
See Trainings
Mastering ABP Framework Book
Do you need assistance from an ABP expert?
Schedule a Meeting
Mastering ABP Framework Book
The Official Guide
Mastering
ABP Framework
Learn More
Mastering ABP Framework Book