Skip to content
Last update: January 30, 2024

Transforming Custom Module to Support DB Agnostic Approach

To transform your custom module to support DB agnostic approach:

  1. Add new Data.[Provider] projects.
  2. Add Project references.
  3. Add Packages for specific database provider:
    1. MySql - Pomelo.EntityFrameworkCore.MySql 6.0.0
    2. PostgreSql - Npgsql.EntityFrameworkCore.PostgreSQL 6.0.0
    3. Sql Server - Microsoft.EntityFrameworkCore.SqlServer
  4. Copy and update:
    1. DbContextOptionsBuilderExtensions.cs
    2. PostgreSqlDbContextFactory.cs
    3. Readme.md
  5. Add DB Agnostic AddDbContext in Module.Initialize.
  6. Add customization extension OnModelCreating to allow configuration of an entity type for different database types.
  7. Refactor and isolate raw Sql server code.
  8. Copy Migrations from Data to SqlServer.
  9. Create new Migrations.
  10. Compile, compress, and test.