You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The template works with EntityFramework because BaseEntity has an Id property that EF picks up by convention as a primary key. If you were to rename that to MyCustomPrimarykey rather than Id things start to fail at runtime with The entity type 'ToDoItem' requires a primary key to be defined..
The answer to this is usually to add a [Key] attribute to the primary key field but how would you go about doing that while still maintaining the "clean architecture" paradigm? I noticed there is a ToDoItemDTO in the Web project because of the [Required] attribute, but if you did another ToDoItemEntity you now are duplicating your model several times over if you need to annotate all of your properties for various reasons.
Is being more lax on "Duplicate Code" the best path or is there something I'm overlooking?
The text was updated successfully, but these errors were encountered:
The template works with EntityFramework because
BaseEntity
has anId
property that EF picks up by convention as a primary key. If you were to rename that toMyCustomPrimarykey
rather thanId
things start to fail at runtime withThe entity type 'ToDoItem' requires a primary key to be defined.
.The answer to this is usually to add a
[Key]
attribute to the primary key field but how would you go about doing that while still maintaining the "clean architecture" paradigm? I noticed there is aToDoItemDTO
in the Web project because of the[Required]
attribute, but if you did anotherToDoItemEntity
you now are duplicating your model several times over if you need to annotate all of your properties for various reasons.Is being more lax on "Duplicate Code" the best path or is there something I'm overlooking?
The text was updated successfully, but these errors were encountered: