Suppose we have two entities Blog
and Post
that Blog
has many Post
s. Post
is saved indirectly through Blog
. When I override OnUpdate
in Post
, it causes to save Post
s that have null Blog
. In the other hand overriding OnUpdate
in Post
causes not saving it properly. Someone else have had same problem.
The code is:
protected override void OnUpdate()
{
UserModified = "UserModified";
DateModified = DateTime.Now;
base.OnUpdate();
}