File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed
application/shared-kernel/SharedKernel/EntityFramework Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -30,8 +30,16 @@ protected override void OnModelCreating(ModelBuilder modelBuilder)
3030 // Set pluralized table names for all aggregates
3131 foreach ( var entityType in modelBuilder . Model . GetEntityTypes ( ) )
3232 {
33- var tableName = entityType . GetTableName ( ) ! . Pluralize ( ) ;
34- entityType . SetTableName ( tableName ) ;
33+ var tableNameAnnotation = entityType . GetAnnotations ( ) . FirstOrDefault ( a => a . Name == "Relational:TableName" ) ;
34+ if ( tableNameAnnotation ? . Value is not null )
35+ {
36+ entityType . SetTableName ( tableNameAnnotation . Value . ToString ( ) ) ;
37+ }
38+ else
39+ {
40+ var tableName = entityType . GetTableName ( ) ! . Pluralize ( ) ;
41+ entityType . SetTableName ( tableName ) ;
42+ }
3543 }
3644
3745 // Ensures that all enum properties are stored as strings in the database.
You can’t perform that action at this time.
0 commit comments