namespace zero.Stores;
public partial class StoreOperations : IStoreOperations
{
///
public virtual async Task> Delete(T model) where T : ZeroIdEntity, new()
{
if (model == null)
{
return Result.Fail("@errors.ondelete.idnotfound");
}
InterceptorInstruction instruction = Interceptors.ForDelete(model);
if (!await instruction.Start(this))
{
return instruction.Result;
}
Session.Delete(model);
await instruction.Complete();
await Session.SaveChangesAsync();
return Result.Success();
}
}