You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
However, it seems setting the snake_case naming convention ignores the max identifier length and instead generates full-length identifiers. If I do not add snake_case naming convention, the identifiers are limited to 30 chars and are protected against conflict by appending ~, ~1, ~2, etc.
The text was updated successfully, but these errors were encountered:
This seems to be specifically a problem when the table name is derived from a DbSet property name; otherwise, if there's no DbSet property, the table name is truncated properly (property names are also truncated).
@AndriySvyryd is it safe to assume that this is a conflict/ordering issue between the convention that sets the table name from the DbSet and the naming rewriting convention?
Repro
publicclassBlogContext:DbContext{// Commenting out the following makes truncation workpublicDbSet<StudentWithAVeryLongNameExceedingTheMaximum> StudentsWithAnotherLongName {get;set;}=null!;protectedoverridevoidOnConfiguring(DbContextOptionsBuilderoptionsBuilder)=> optionsBuilder
.UseNpgsql("Host=localhost;Username=test;Password=test").UseSnakeCaseNamingConvention().LogTo(Console.WriteLine, LogLevel.Information).EnableSensitiveDataLogging();protectedoverridevoidOnModelCreating(ModelBuildermodelBuilder){
modelBuilder.Model.SetMaxIdentifierLength(10);
modelBuilder.Entity<StudentWithAVeryLongNameExceedingTheMaximum>();}}publicclassStudentWithAVeryLongNameExceedingTheMaximum{publicintId{get;set;}publicstring?PropertyNameThatIsVeryLong1{get;set;}publicstring?PropertyNameThatIsVeryLong2{get;set;}}
I use
MaxIdentifierLength
limit to support Oracle:However, it seems setting the snake_case naming convention ignores the max identifier length and instead generates full-length identifiers. If I do not add snake_case naming convention, the identifiers are limited to 30 chars and are protected against conflict by appending
~
,~1
,~2
, etc.The text was updated successfully, but these errors were encountered: