コード例 #1
0
 /// <summary>
 /// Executes the command against the connection and converts the results to <typeparamref name="TEntity" /> objects asynchronously.
 /// </summary>
 /// <typeparam name="TEntity">The type of the entity.</typeparam>
 /// <param name="dataQuery">The <see cref="IDataQueryAsync"/> for this extension method.</param>
 /// <param name="cancellationToken">The cancellation instruction.</param>
 /// <returns>
 /// An <see cref="T:System.Collections.Generic.IEnumerable`1" /> of <typeparamref name="TEntity" /> objects.
 /// </returns>
 public static Task <IEnumerable <TEntity> > QueryAsync <TEntity>(this IDataQueryAsync dataQuery, CancellationToken cancellationToken = default(CancellationToken))
     where TEntity : class, new()
 {
     return(dataQuery.QueryAsync(ReaderFactory.EntityFactory <TEntity>, cancellationToken));
 }
コード例 #2
0
 /// <summary>
 /// Executes the query and returns the first row in the result as a dynamic object asynchronously.
 /// </summary>
 /// <param name="dataQuery">The <see cref="IDataQueryAsync"/> for this extension method.</param>
 /// <param name="cancellationToken">The cancellation instruction.</param>
 /// <returns>
 /// A instance of a dynamic object if row exists; otherwise null.
 /// </returns>
 public static Task <dynamic> QuerySingleAsync(this IDataQueryAsync dataQuery, CancellationToken cancellationToken = default(CancellationToken))
 {
     return(dataQuery.QuerySingleAsync(ReaderFactory.DynamicFactory, cancellationToken));
 }
コード例 #3
0
 /// <summary>
 /// Executes the query and returns the first column of the first row in the result set returned by the query asynchronously. All other columns and rows are ignored.
 /// </summary>
 /// <typeparam name="TValue">The type of the value.</typeparam>
 /// <param name="dataQuery">The <see cref="IDataQuery"/> for this extension method.</param>
 /// <param name="cancellationToken">The cancellation instruction.</param>
 /// <returns>
 /// The value of the first column of the first row in the result set.
 /// </returns>
 public static Task <TValue> QueryValueAsync <TValue>(this IDataQueryAsync dataQuery, CancellationToken cancellationToken = default(CancellationToken))
 {
     return(dataQuery.QueryValueAsync <TValue>(null, cancellationToken));
 }