❔ EF Core question
Data annotations vs fluent api? What are pros and cons? a pro for fluent api I see is that I can decouple models away from db definitions and for data annotations the simplicity, however data annotations seem to be lacking some things that fluent api has
4 Replies
fluent 100% of the time, all the time
You don't want to pollute your models with database concerns
thank you
https://learn.microsoft.com/en-us/ef/core/modeling/#grouping-configuration also lets you do it in their own files, so as to not bloat your model configuration method
Creating and Configuring a Model - EF Core
Overview of creating and configuring a Entity Framework Core model via Fluent API, Data Annotations and conventions.
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.