Skip to content

Latest commit

 

History

History
34 lines (24 loc) · 696 Bytes

GCop630.md

File metadata and controls

34 lines (24 loc) · 696 Bytes

GCop 630

"Override the Validate() method and write your validation logic there."

Rule description

For adding validation criteria we should override Validate() method and add our custom logics there. There is no need to write validation logics in other methods.

Note: This rule is sensitive to invoking a method which has the word Validate in its name.

Example

protected override async Task OnSaving(CancelEventArgs e)
{
    await base.OnSaving(e);
    
    if (SomeValidateMethod())
        ...;
    ...
}

should be 🡻

public override async Task Validate()
{ 
    await base.Validate();
    
    if (SomeValidateMethod())
        ...;
}