public async Task <bool> DeleteAsync(Module.DeleteModel model, CancellationToken cancellationToken = default) { var cacheKey = _cacheHelper.CreateKey <Module.DeleteModel, bool>(model); if (TryGetFromCache(cacheKey, out bool result)) { return(result); } using var process = GetProcess <IDeleteModule>(); process.Model = model; return(TrySaveToCache(cacheKey, await process.ExecuteAsync(cancellationToken), _configuration.CacheExpiration.Module.Delete)); }
public async Task <bool> ExecuteAsync(Module.DeleteModel model, SqlConnection connection, SqlTransaction transaction = default, CancellationToken cancellationToken = default) { using var command = Get(model, connection, transaction); return(await command.ExecuteNonQueryAsync(cancellationToken) == ALLOWEDAFFECTEDROWS); }
private SqlCommand Get(Module.DeleteModel model, SqlConnection connection, SqlTransaction transaction = default) => connection.CreateProcedureCommand(PROCEDURE, transaction) .AddInParameter(PARAM_ID, model.Id) .AddInParameter(PARAM_ISCASCADED, model.IsCascaded) .AddSessionIdParameter(_sessionProvider);
public Task <bool> DeleteAsync(Module.DeleteModel model, CancellationToken cancellationToken = default) { using var process = GetProcess <IDeleteModule>(); process.Model = model; return(process.ExecuteAsync(cancellationToken)); }