|The method you're overriding doesn't return a
ValueTask), so you can't make the override an
You would need to make the method in the base class return either
ValueTask<bool>. The calling method would then need to wait for the returned task to complete before proceeding, either using
It's also not helped by the fact that the methods you want to call on a background thread are synchronous methods. It would be better if they were
async as well, so you could avoid explicitly spinning up a new
Task to run them off-UI.
public override ValueTask<bool> SaveChanges()
bool isValid = Validate();
var task = Company.Id == 0
? Task.Run(() => AppCore.BizObject.AddCompany(Company))
: Task.Run(() => AppCore.BizObject.UpdateCompany(Company));
} Understanding the Whys, Whats, and Whens of ValueTask | .NET Blog[^]
"These people looked deep within my soul and assigned me a number based on the order in which I joined."