In my model, I have a handful of properties that occur on multiple types. For example, many types have a CreatedByUserId
and CreatedDate
. Types that can be updated have a LastUpdatedByUserId
and LastUpdatedDate
.
My first thought is to use Complex Types to encapsulate these fields to make my mappings easier. However, as noted below, Complex Types cannot have navigation properties, so no CreatedByUser
on my entity.
EF-Code first complex type with a navigational property
EF4 complex type with navigation property (is it possible) or alternatives?
One option is it use base classes, but now I need 3, CreatedBy only, LastUpdatedBy only, and both. Not to mention this is one of several scenarios, which could lead to a very large number of base classes and that just feels wrong.
Do I just bite the bullet and define these properties on each type? Is there a better way to handle this?