/// <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)); }
/// <summary> /// Executes the query and returns the first row in the result as a <typeparamref name="TEntity" /> object 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> /// A instance of <typeparamref name="TEntity" /> if row exists; otherwise null. /// </returns> public static Task <TEntity> QuerySingleAsync <TEntity>(this IDataQueryAsync dataQuery, CancellationToken cancellationToken = default(CancellationToken)) where TEntity : class, new() { return(dataQuery.QuerySingleAsync(ReaderFactory.EntityFactory <TEntity>, cancellationToken)); }