Skip to content

Method CreateTableColumns of custom NpgsqlMigrationsSqlGenerator is not called #3440

@oopee

Description

@oopee

The method CreateTableColumns is not called for custom SQL generators. See the code below:

public class MyCustomGenerator : NpgsqlMigrationsSqlGenerator
{
    public NpgsqlCustomSqlGenerator(MigrationsSqlGeneratorDependencies dependencies, INpgsqlSingletonOptions singletonOptions)
        : base(dependencies, singletonOptions)
    {
    }
	
    protected override void CreateTableColumns(CreateTableOperation operation, IModel model, MigrationCommandListBuilder builder)
    {
        // This method is never called!
    }
}

The reason is that the base class NpgsqlMigrationsSqlGenerator calls that method using base. prefix which ignores overriden methods. The code below is from NpgsqlMigrationsSqlGenerator.cs, lines 185-190.

using (builder.Indent())
{
    base.CreateTableColumns(operation, model, builder);
    base.CreateTableConstraints(operation, model, builder);
    builder.AppendLine();
}

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions