Ejemplo n.º 1
0
 /// <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());
     }
 }
Ejemplo n.º 2
0
        /// <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));
        }
Ejemplo n.º 3
0
        /// <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());
        }
Ejemplo n.º 4
0
        /// <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));
        }
Ejemplo n.º 5
0
 /// <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();
Ejemplo n.º 6
0
 public virtual Task <bool> DeleteAsync(int id) =>
 ExecuteAsync($"delete from {TableName} where id=@id", ("@id", id));
Ejemplo n.º 7
0
 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);