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

ABP Studio: The Missing Tool for .NET Developers

15 Aug, 17:00
Online
Watch the Event
Mastering ABP Framework Book
Mastering ABP Framework

This book will help you gain a complete understanding of the framework and modern web application development techniques.

Learn More