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
When certain properties of the domain entities (e.g. Product) are modified, it would be expected for the backend to update the LastModifiedAt and LastModifiedBy audit fields on the given entity.
But this doesn't happen, because certain properties are value objects, configured as EF Core owned type navigation properties. For example updating the price of a product fails to update the two aforementioned fields on the given product entity; even though the modification involves assigning a completely new Money instance to the property, since they are immutable.
I'm actually not sure if this is a glitch due to EF Core's slightly sketchy support for owned types (or perhaps navigation properties that have value conversion configured), OR actually normal expected behavior.
But in either case, it would be probably better to move the responsibility of setting these properties right into the domain entities, because arguably it's a domain concern that entities should have properly set last modified fields.
Tasks:
Make sure all modifications of domain entities lead to updated LastModified fields.
Consider moving this responsibility from DbContext right into the domain entities (possibly with the help of MyEntity abstract base class).
Also check and possibly expand the integration tests... it seems these things aren't covered.
The text was updated successfully, but these errors were encountered:
When certain properties of the domain entities (e.g.
Product
) are modified, it would be expected for the backend to update theLastModifiedAt
andLastModifiedBy
audit fields on the given entity.But this doesn't happen, because certain properties are value objects, configured as EF Core owned type navigation properties. For example updating the price of a product fails to update the two aforementioned fields on the given product entity; even though the modification involves assigning a completely new
Money
instance to the property, since they are immutable.I'm actually not sure if this is a glitch due to EF Core's slightly sketchy support for owned types (or perhaps navigation properties that have value conversion configured), OR actually normal expected behavior.
But in either case, it would be probably better to move the responsibility of setting these properties right into the domain entities, because arguably it's a domain concern that entities should have properly set last modified fields.
Tasks:
DbContext
right into the domain entities (possibly with the help ofMyEntity
abstract base class).The text was updated successfully, but these errors were encountered: