FirebirdSQL / NETProvider

Firebird ADO.NET Data Provider
https://www.firebirdsql.org/en/net-provider/
Other
152 stars 62 forks source link

EntityFrameworkCore Scaffolding: Increase maximum identifier lenght for Firebird 4.0 #1132

Closed bgrauer-atacom closed 10 months ago

bgrauer-atacom commented 10 months ago

The maximum identifier length has changed from 31 characters in version 3 to 63 characters in version 4.

The FbConventionSetBuilder has a RelationalMaxIdentifierLengthConvention which is still set to 31. This can lead to unwanted name cuts when using Scraffolding.

cincuranet commented 10 months ago

Duplicate of https://github.com/FirebirdSQL/NETProvider/issues/931.

bgrauer-atacom commented 10 months ago

There is a workaround which can be applied to the DbContext to increase the length:

    protected override void ConfigureConventions(ModelConfigurationBuilder configurationBuilder)
    {
        base.ConfigureConventions(configurationBuilder);
        configurationBuilder.Conventions.Replace((services) =>
        {
            var dependencies = services.GetRequiredService<ProviderConventionSetBuilderDependencies>();
            var relationalDependencies = services.GetRequiredService<RelationalConventionSetBuilderDependencies>();
            return new RelationalMaxIdentifierLengthConvention(63, dependencies, relationalDependencies);
        });
    }