Skip to content

Commit 0f09337

Browse files
author
Oren (electricessence)
committed
Revised names.
1 parent 7d80d0b commit 0f09337

File tree

5 files changed

+1565
-1398
lines changed

5 files changed

+1565
-1398
lines changed

Documentation.xml

Lines changed: 64 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ExpressiveCommandBase.cs

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -441,7 +441,15 @@ public T ExecuteScalar<T>(Func<object,T> transform)
441441
/// <returns>The resultant DataTabel.</returns>
442442
public DataTable LoadTable()
443443
=> Execute(command => command.ToDataTable());
444-
444+
445+
/// <summary>
446+
/// Loads all data from a command through an IDataReader into a DataTables.
447+
/// Calls .NextResult() to check for more results.
448+
/// </summary>
449+
/// <returns>The resultant list of DataTables.</returns>
450+
public List<DataTable> LoadTables()
451+
=> Execute(command => command.ToDataTables());
452+
445453
/// <summary>
446454
/// Converts all IDataRecords into a list using a transform function.
447455
/// </summary>
@@ -523,6 +531,21 @@ public IEnumerable<T> Results<T>(IEnumerable<(string Field, string Column)> fiel
523531
where T : new()
524532
=> Execute(command => command.Results<T>(fieldMappingOverrides));
525533

534+
/// <summary>
535+
/// Reads the first column from every record and returns the results as a list.
536+
/// </summary>
537+
/// <returns>The list of transformed records.</returns>
538+
public List<object> FirstOrdinalResults()
539+
=> ToList(r => r.GetValue(0));
540+
541+
542+
/// <summary>
543+
/// Reads the first column from every record.
544+
/// </summary>
545+
/// <returns>The enumerable of casted values.</returns>
546+
public IEnumerable<T0> FirstOrdinalResults<T0>()
547+
=> Execute(command => command.FirstOrdinalResults<T0>());
548+
526549
/// <summary>
527550
/// Iterates each record and attempts to map the fields to type T.
528551
/// Data is temporarily stored (buffered in entirety) in a queue of dictionaries before applying the transform for each iteration.

ExpressiveDbCommandBase.cs

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -187,13 +187,29 @@ public Task<List<T>> TakeAsync<T>(Func<IDataRecord, T> transform, int count)
187187
.ContinueWith(t => results);
188188
}
189189

190-
/// <summary>
191-
/// Asynchronously iterates all records within the current result set using an IDataReader and returns the desired results.
192-
/// </summary>
193-
/// <param name="n">The first ordinal to include in the request to the reader for each record.</param>
194-
/// <param name="others">The remaining ordinals to request from the reader for each record.</param>
195-
/// <returns>The QueryResult that contains all the results and the column mappings.</returns>
196-
public Task<QueryResult<Queue<object[]>>> RetrieveAsync(int n, params int[] others)
190+
191+
/// <summary>
192+
/// Reads the first column from every record and returns the results as a list.
193+
/// </summary>
194+
/// <returns>The list of transformed records.</returns>
195+
public Task<List<object>> FirstOrdinalResultsAsync()
196+
=> ToListAsync(r => r.GetValue(0));
197+
198+
199+
/// <summary>
200+
/// Reads the first column from every record.
201+
/// </summary>
202+
/// <returns>The enumerable of casted values.</returns>
203+
public Task<IEnumerable<T0>> FirstOrdinalResultsAsync<T0>()
204+
=> ExecuteAsync(command => command.FirstOrdinalResultsAsync<T0>());
205+
206+
/// <summary>
207+
/// Asynchronously iterates all records within the current result set using an IDataReader and returns the desired results.
208+
/// </summary>
209+
/// <param name="n">The first ordinal to include in the request to the reader for each record.</param>
210+
/// <param name="others">The remaining ordinals to request from the reader for each record.</param>
211+
/// <returns>The QueryResult that contains all the results and the column mappings.</returns>
212+
public Task<QueryResult<Queue<object[]>>> RetrieveAsync(int n, params int[] others)
197213
=> RetrieveAsync(new int[1] { n }.Concat(others));
198214

199215
/// <summary>

0 commit comments

Comments
 (0)