コード例 #1
0
 /// <summary>
 /// Executes the query and returns the first row in the result as a <typeparamref name="TEntity" /> object.
 /// </summary>
 /// <typeparam name="TEntity">The type of the entity.</typeparam>
 /// <param name="dataQuery">The <see cref="IDataQuery"/> for this extension method.</param>
 /// <returns>
 /// A instance of <typeparamref name="TEntity" /> if row exists; otherwise null.
 /// </returns>
 public static TEntity QuerySingle <TEntity>(this IDataQuery dataQuery)
     where TEntity : class, new()
 {
     return(dataQuery.QuerySingle(ReaderFactory.EntityFactory <TEntity>));
 }
コード例 #2
0
 /// <summary>
 /// Executes the query and returns the first row in the result as a dynamic object.
 /// </summary>
 /// <param name="dataQuery">The <see cref="IDataQuery"/> for this extension method.</param>
 /// <returns>
 /// A instance of a dynamic object if row exists; otherwise null.
 /// </returns>
 public static dynamic QuerySingle(this IDataQuery dataQuery)
 {
     return(dataQuery.QuerySingle(ReaderFactory.DynamicFactory));
 }