Reputation: 781
I'm starting with a new project and am using EF core with fluent API.
Currently I have some few configuration classes for a simple data model. Over time it will grow, there will be more and more. Some with changes on the existing data model, some with new features or even deletions.
Upvotes: 0
Views: 416
Reputation: 146
I myself place the configurations inside the .cs file as my models file.
And their naming convention would be same as the model plus "Configuration" e.g. User
and UserConfiguration
.
As you are using fluent API, the configuration classes implement I think IEntityTypeConfiguration<>
So you can easily register all configurations Generically in OnModelCreating
in you Context class.(using reflection, I can shre some peice of code if you want)
In this case you never mind registration as a new model is added and for modifying there is no way but open your main model's file and change it without pain of losing in folders looking for config file.
Upvotes: 1