public async Task <T> ConvertAsync(DapperAttribute attr, CancellationToken cancellationToken) { if (attr == null) { throw new System.ArgumentNullException(nameof(attr)); } string sql = attr.Sql; if (Utility.IsSqlScript(sql)) { sql = Utility.GetTextFromFile(_path, attr.Sql); } DynamicParameters parameters; if (Utility.IsJson(attr.Parameters)) { parameters = GetParametersFromJSON(attr.Parameters); } else { parameters = GetParametersFromString(attr.Parameters); } var result = await GenericSqlStore.ExecuteQuery(parameters, attr.SqlConnection, sql, attr.CommandTimeout, attr.IsolationLevel, attr.CommandType); return(HandleQueryResult(result)); }
public async Task AddAsync(SqlInput input, CancellationToken cancellationToken = default(CancellationToken)) { if (input == null) { throw new System.ArgumentNullException(nameof(input)); } string sql = _dapperAttribute.Sql; if (Utility.IsSqlScript(sql)) { sql = Utility.GetTextFromFile(_path, sql); } var parameters = GetParameters(input.Parameters); await GenericSqlStore.Execute(parameters, _dapperAttribute.SqlConnection, sql, _dapperAttribute.CommandTimeout, _dapperAttribute.IsolationLevel, _dapperAttribute.CommandType); }