public async Task <bool> DeleteAsync(Application.DeleteModel model, CancellationToken cancellationToken = default) { var cacheKey = _cacheHelper.CreateKey <Application.DeleteModel, bool>(model); if (TryGetFromCache(cacheKey, out bool result)) { return(result); } using var process = GetProcess <IDeleteApplication>(); process.Model = model; return(TrySaveToCache(cacheKey, await process.ExecuteAsync(cancellationToken), _configuration.CacheExpiration.Application.Delete)); }
public async Task <bool> ExecuteAsync(Application.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(Application.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(Application.DeleteModel model, CancellationToken cancellationToken = default) { using var process = GetProcess <IDeleteApplication>(); process.Model = model; return(process.ExecuteAsync(cancellationToken)); }