namespace zero.Raven;
public partial class RavenOperations : IRavenOperations
{
///
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 (InterceptorBlocker == null && !await instruction.Start(this))
{
return instruction.Result;
}
Session.Delete(model);
await Session.SaveChangesAsync();
if (InterceptorBlocker == null)
{
await instruction.Complete();
}
await Session.SaveChangesAsync();
return Result.Success();
}
}