namespace zero.Raven; public partial class RavenOperations : IRavenOperations { /// public virtual Task> Delete(T model) where T : ZeroIdEntity, new() => Delete(model.Id); /// public virtual async Task> Delete(string id) where T : ZeroIdEntity, new() { T model = await Load(id); if (model == null) { return Result.Fail("@errors.ondelete.idnotfound"); } InterceptorInstruction instruction = Interceptors.ForDelete(model); if (InterceptorBlocker == null && !await instruction.Start(this)) { return instruction.Result; } if (model is ISupportsSoftDelete softDeleteModel) { softDeleteModel.IsDeleted = true; } else { Session.Delete(model); } await Session.SaveChangesAsync(); if (InterceptorBlocker == null) { await instruction.Complete(); } await Session.SaveChangesAsync(); return Result.Success(); } }