Skip to content

Latest commit

 

History

History
29 lines (21 loc) · 627 Bytes

GCop143.md

File metadata and controls

29 lines (21 loc) · 627 Bytes

GCop 143

"First line of OnSaved() method must be a call to base.OnSaved() otherwise CachedReferences will have a problem."

Rule description

When overriding event handler methods in entity classes, you should invoke the base implementation. Otherwise you can accidentally skip any event handler code written in the parent class.

Example

protected override async Task OnSaved(SaveEventArgs e)
{
    if (SomeCondition) {...}
    ...
}

should be 🡻

protected override async Task OnSaved(SaveEventArgs e)
{
    await base.OnSaved(e);
    
    if (SomeCondition) {...}
    ...
}