2025-07-30 01:09:51 +03:00

3.4 KiB

Key Files and Their Current State

DependencyInjectionExtensions.cs

Status: Fully updated Key Changes:

  • Added metadataSchema and metadataPrefix parameters
  • Renamed metadataLocation to metadataStorage
  • Added comprehensive validation logic
  • Registered TableNamingService as singleton
  • Removed LogConfiguration method

Current AddMigration signature:

public static void AddMigration(this IServiceCollection services,
    DatabaseType databaseType = DatabaseType.SQLite,
    MetadataStorage metadataStorage = MetadataStorage.XmlFile,
    string connectionName = "DatabaseConnection",
    string workspace = "Workspace",
    string scriptsDirectoryPath = "Scripts",
    string metadataSchema = "migration",
    string metadataPrefix = null)

ServiceConfiguration.cs

Status: Fully updated Key Changes:

  • Added MetadataSchema and MetadataPrefix properties
  • Updated constructor to accept new parameters
  • Changed MetadataLocation to MetadataStorage

TableNamingService.cs

Status: Fully updated
Key Changes:

  • Converted from static to injectable service
  • Added ProcessSqlScript method for placeholder replacement
  • Now receives ServiceConfiguration via constructor

Key Methods:

public string GetTableName(string baseTableName)
public string GetSchemaName()
public string ProcessSqlScript(string sqlContent)

SQL Scripts with Placeholders

Status: All updated

SQL Server Scripts:

  • 01.CreateMigrationSchema.sql: Uses {MetadataSchema}
  • 02.MigrationTables.sql: Uses {MetadataSchema} and {TablePrefix}

SQLite Scripts:

  • 01.MigrationSignatureTable.sql: Uses {TablePrefix}
  • 02.MigratedVersionTable.sql: Uses {TablePrefix}
  • 03.MigratedScriptTable.sql: Uses {TablePrefix}

Entity Framework Configurations

Status: All simplified Key Changes:

  • Removed unnecessary if statements for schema handling
  • All now use TableNamingService via constructor injection
  • EF Core handles null schemas automatically

Files Updated:

  • MigrationSignatureConfiguration.cs
  • MigratedVersionConfiguration.cs
  • MigratedScriptConfiguration.cs

MigrationDbContext.cs

Status: Updated Key Changes:

  • Now receives TableNamingService via constructor
  • Passes service to all configurations

MigrationRepository.cs

Status: Updated
Key Changes:

  • Now uses TableNamingService for dynamic table names
  • Updated MigrationTablesAreSet method with dynamic queries

MetadataLocationService.cs

Status: Updated Key Changes:

  • Uses embedded scripts with placeholder processing
  • Removed dynamic SQL generation methods
  • Added TableNamingService dependency

MigrationSignaturesService.cs

Status: Updated Key Changes:

  • Updated to use MetadataStorage instead of MetadataLocation
  • XML file naming now supports metadataPrefix

Constants Updated

Status: Updated

  • MetadataLocation.cs renamed to MetadataStorage.cs
  • ManifestResources.cs unchanged (still valid)
  • DatabaseType.cs unchanged

Files Removed

  • SqlScriptGeneratorService.cs Deleted (no longer needed)

Compilation Status

  • Project builds successfully with dotnet build
  • No compilation errors
  • ⚠️ Minor warnings about lowercase type names (acceptable)

Testing Status

  • No unit tests exist yet
  • Manual verification via successful compilation
  • All refactoring paths verified