public IAsyncEnumerable <GenericDataContainer> GetManyAsync( string dataType, string whereArguments, string orderByArguments, uint?limit = null) { var query = queryBuilder.Build( new DataApiSqlQuery( fromArguments: dataType, whereArguments: whereArguments, orderByArguments: orderByArguments, limitArguments: limit?.ToString()), dataType); return(sqlQueryExecutor.ExecuteReaderAsync(query).Select(reader => GenericDataContainerReconstructor.Reconstruct((SqlDataReader)reader))); }
public async Task <GenericDataContainer> GetFromIdAsync(string dataType, string id) { if (!IsValidId(id)) { return(null); } var query = $"SELECT TOP 1 * FROM {dataType} WHERE Id = '{id}'"; var container = await sqlQueryExecutor.ExecuteReaderAsync(query).Select(reader => GenericDataContainerReconstructor.Reconstruct((SqlDataReader)reader)).FirstOrDefaultAsync(); return(container); }