❔ Hello, Fluent Api
Hi, I have fluent api in my project, I made configuration in another library after I use modelBuilder.ApplyConfiguration() function in DbContext in OnModelCreating function. It works but I dont like this approach because every time when I add new configuration I also add new function in OnModelCreating function, What else I can do ?
2 Replies
https://www.learnentityframeworkcore.com/configuration/fluent-api
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
modelBuilder.ApplyConfigurationsFromAssembly(Assembly.GetExecutingAssembly());
}
Fluent API Configuration
How to use the Entity Framework Core Fluent API to configure aspects of the model
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.