lundi 22 avril 2019

Entity Framework Core Fluent API/Annotations

Which is better to use?

I don't have much experience with EF or EF Core patterns. When I'm reading articles about Entity Framework some peoples are using annotations for annotating PKs, FKs, Generated values, etc. and other people (I think more common case) are using Fluent API for same purpose.

What I'm interested in is that if there is any significant difference between this two approaches.

Main questions are:

  • Can I do more with Fluent API or vice versa?

  • Is it just question of preference or it depends on project type or size?

  • Is it good idea to combine those two approaches in some way?

  • Should I avoid using annotations?

I know there is no just one answer for those questions but I wonder what is opinion of experienced developers.

Currently i intend to use this pattern for entity configuration: source

Please, feel free to correct my question grammatically.

Aucun commentaire:

Enregistrer un commentaire