예제 #1
0
 /// <summary>
 /// Query extensions.
 /// </summary>
 /// <typeparam name="T">T.</typeparam>
 /// <param name="db">APDatabase.</param>
 /// <param name="command">The 'SELECT' command.</param>
 /// <param name="fillup">Fill function.</param>
 /// <returns>IEnumerable.</returns>
 public static IEnumerable <T> Query <T>(this APDatabase db, APSqlSelectCommand command, Func <IDataReader, T> fillup)
 {
     using (IDataReader reader = db.ExecuteReader(command))
     {
         while (reader.Read())
         {
             yield return(fillup(reader));
         }
     }
 }
예제 #2
0
 /// <summary>
 /// Execute.
 /// </summary>
 /// <param name="command">The command.</param>
 /// <param name="db">The database.</param>
 /// <returns>The reader.</returns>
 public static IDataReader executeReader(this APSqlSelectCommand command, APDatabase db)
 {
     return(db.ExecuteReader(command));
 }
예제 #3
0
 /// <summary>
 /// Executes the CommandText against the Connection and builds an IDataReader.
 /// </summary>
 /// <param name="command">The command.</param>
 /// <returns>An IDataReader object.</returns>
 protected IDataReader ExecuteReader(APSqlCommand command)
 {
     return(_database.ExecuteReader(command));
 }