C
C#2y ago
barcode

❔ 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
Pobiega
Pobiega2y ago
fluent 100% of the time, all the time You don't want to pollute your models with database concerns
barcode
barcodeOP2y ago
thank you
Pobiega
Pobiega2y ago
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.
Accord
Accord2y ago
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.
Want results from more Discord servers?
Add your server