/// <summary> /// Executes the query and returns the result as a list of lists asynchronously /// This method is only supported if the underlying provider propertly implements async behaviour. /// </summary> public async Task <IEnumerable <IReadOnlyCollection <dynamic> > > AsMultiResultSetAsync() { using (var reader = await ExecuteAsync.Reader()) { return(reader.ToMultiResultSet().ToList()); } }
/// <summary> /// Executes the query and returns the result as a list of [T] asynchronously /// This method is only supported if the underlying provider propertly implements async behaviour. /// </summary> /// <typeparam name="T"></typeparam> /// <param name="selector">mapping function that transforms a datarecord (wrapped as a dynamic object) to an instance of type [T]</param> public async Task <IEnumerable <T> > AsEnumerableAsync <T>(Func <dynamic, T> selector) { var reader = await ExecuteAsync.Reader(); return(reader.AsEnumerable().ToDynamicDataRecord().Select(selector)); }
/// <summary> /// Executes the query and returns the result as a list of dynamic objects asynchronously /// This method is only supported if the underlying provider propertly implements async behaviour. /// </summary> public async Task <IEnumerable <dynamic> > AsEnumerableAsync() { var reader = await ExecuteAsync.Reader(); return(reader.AsEnumerable().ToExpandoList()); }
/// <summary> /// Executes the command, returning the first column of the first result, converted to the type T asynchronously. /// This method is only supported if the underlying provider propertly implements async behaviour. /// </summary> /// <typeparam name="T">return type</typeparam> public async Task <T> AsScalarAsync <T>() { var result = await ExecuteAsync.Scalar(); return(ConvertTo <T> .From(result)); }
/// <summary> /// Executes the command as a statement, returning the number of rows affected asynchronously /// This method is only supported if the underlying provider propertly implements async behaviour. /// </summary> public Task <int> AsNonQueryAsync() => ExecuteAsync.NonQuery();
public virtual Task <bool> DeleteAsync(int id) => ExecuteAsync($"delete from {TableName} where id=@id", ("@id", id));
public static Task ExecuteAsync(this IEventStore store, ICommand command, string streamName, Func <EventRecord[]> action, Func <IEvent[], Task> pub) => ExecuteAsync <TestState>(store, command, (null, streamName), state => Task.FromResult(action()), pub);