Hi guys,
how can I check that entity itself exists before executing Update or Delete?
I tried using something like the code below, but getting an error "Property name must be specified". How to implement such logic?
how can I check that entity itself exists before executing Update or Delete?
I tried using something like the code below, but getting an error "Property name must be specified". How to implement such logic?
RuleFor(x=>x).Must(ExistsInDatabase).WithMessage("Attempt to work with nonexistent entity");
private bool ExistsInDatabase(MyClass myClassInstance)
{
if (myClassInstance == null)
return false;
return true;
}