VOOZH about

URL: https://www.nuget.org/packages/EFCore.MigrationExtensions.PostgreSQL/

⇱ NuGet Gallery | EFCore.MigrationExtensions.PostgreSQL 10.0.0




EFCore.MigrationExtensions.PostgreSQL 10.0.0

dotnet add package EFCore.MigrationExtensions.PostgreSQL --version 10.0.0
 
 
NuGet\Install-Package EFCore.MigrationExtensions.PostgreSQL -Version 10.0.0
 
 
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="EFCore.MigrationExtensions.PostgreSQL" Version="10.0.0" />
 
 
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="EFCore.MigrationExtensions.PostgreSQL" Version="10.0.0" />
 
Directory.Packages.props
<PackageReference Include="EFCore.MigrationExtensions.PostgreSQL" />
 
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add EFCore.MigrationExtensions.PostgreSQL --version 10.0.0
 
 
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: EFCore.MigrationExtensions.PostgreSQL, 10.0.0"
 
 
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package EFCore.MigrationExtensions.PostgreSQL@10.0.0
 
 
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=EFCore.MigrationExtensions.PostgreSQL&version=10.0.0
 
Install as a Cake Addin
#tool nuget:?package=EFCore.MigrationExtensions.PostgreSQL&version=10.0.0
 
Install as a Cake Tool
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

EFCore.MigrationExtensions

👁 Version

Adds views, synonyms, stored procedures, etc. (so-called SQL objects) to the EF model. Creates migrations, when those objects are changed. SQL objects are defined as raw SQL in C#-code or in embedded resources. They can be even generated at runtime.

All EF Core model-tracking and application features are supported:

  • When SQL-objects change, migrations are generated.
  • SQL-objects are applied on Database.Migrate() or Database.EnsureCreated().
  • Correct script is generated on dotnet ef migrations script.
  • Database is updated on dotnet ef database update.

How to use

  • Call UseSqlObjects:
    • either in and
    • or in
  • Create an empty in your entry point. The class should inherit from CustomNpgsqlDesignTimeServices
  • Add SqlObjects to your context in
  • Generate migrations / scripts / update DB as usual

Ways to add SqlObjects to the model

protected override void OnModelCreating(ModelBuilder modelBuilder)
{
 //...

 // Add SqlObject directly
 // Order is used to define the order in which objects are created / updated in DB
 const string Sql = "create or replace view migr_ext_tests.v_view_10 as select * from migr_ext_tests.my_table;";
 modelBuilder.AddSqlObjects(new SqlObject(Name: "v_view_10", SqlCode: Sql) { Order = 10 });

 // Add all embedded resources, placed in assembly's "Sql" folder
 // Only *.sql resources are added
 // There is no way to define order for embedded objects
 // Use resources' names if you need to sort objects
 modelBuilder.AddSqlObjects(assembly: typeof(Class1).Assembly, folder: "Sql");
}

Known limitations

  • Doesn't drop deleted objects (generates non compilable code, so the developer should write drop-code himself).
  • Only C# is supported
  • PostgreSQL and SqlServer are supported, but any other DB can be easily added (use as an example)

Testing

  1. Open TestDataAccessLayer folder in terminal
  2. Set connection string at TestEntryPoint/appsettings.json
  3. Install dotnet-ef
  • dotnet tool restore
  1. Use the following commands to add migrations / update DB
  • dotnet dotnet-ef migrations add MyMigr --context TestContext --project TestDataAccessLayer.csproj --startup-project ../TestEntryPoint/TestEntryPoint.csproj
  • dotnet dotnet-ef database update --context TestContext --project TestDataAccessLayer.csproj --startup-project ../TestEntryPoint/TestEntryPoint.csproj
  • dotnet dotnet-ef migrations script TestMigr Meetup1 --context TestContext --project TestDataAccessLayer.csproj --startup-project ../TestEntryPoint/TestEntryPoint.csproj
Product Versions Compatible and additional computed target framework versions.
.NET net10.0 net10.0 is compatible.  net10.0-android net10.0-android was computed.  net10.0-browser net10.0-browser was computed.  net10.0-ios net10.0-ios was computed.  net10.0-maccatalyst net10.0-maccatalyst was computed.  net10.0-macos net10.0-macos was computed.  net10.0-tvos net10.0-tvos was computed.  net10.0-windows net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
10.0.0 128 1/23/2026
9.0.1 611 3/25/2025
9.0.0 224 3/16/2025
8.0.1 828 3/25/2025
8.0.0 223 3/16/2025
7.0.1 544 3/25/2025
7.0.0 219 3/16/2025
6.0.1 559 3/25/2025
6.0.0 166 3/15/2025