-
Notifications
You must be signed in to change notification settings - Fork 11
Open
Description
Hello!
I'd like to configure my database table naming scheme manually within my IEntityTypeConfigureation<>
classes. I don't want SpatialFocus/EntityFrameworkCore.Extensions
to apply any NamingScheme to any non-enum classes at all.
For context, this is my use-case
- I am using
SpatialFocus/EntityFrameworkCore.Extensions
for the enum to table features - I only want
SpatialFocus/EntityFrameworkCore.Extensions
to work with enums in this table capacity - I do not want
SpatialFocus/EntityFrameworkCore.Extensions
to touch my other 'non-enum' tables
Is it possible to disable this without manually selecting all entities to exclude?
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
modelBuilder.ApplyConfigurationsFromAssembly(typeof(AppIdentityUserConfiguration).Assembly);
modelBuilder.ConfigureEnumLookup(
EnumLookupOptions.Default.UseNumberAsIdentifier()
.UseEnumsWithAttributeOnly()
.SetDeleteBehavior(DeleteBehavior.NoAction));
modelBuilder.ConfigureNames(
NamingOptions.Default.SkipEntireEntities(_ => _.Name.Length > 0) // <--- It would be nice to not do this
);
}
This is the result if I specify:
modelBuilder.ConfigureNames(
NamingOptions.Default.SkipEntireEntities(_ => _.Name.Length > 0) // <--- It would be nice to not do this
);
If I do not specify the above code snippet, then all tables will be styled to the configuration of the enum
which in this example is snake_case
with ClrType
Metadata
Metadata
Assignees
Labels
No labels