Skip to content

Commit 0819918

Browse files
author
electricessence
authored
Update README.md
1 parent 9747fec commit 0819918

1 file changed

Lines changed: 14 additions & 2 deletions

File tree

README.md

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ var result = connectionFactory
2626

2727
## Asynchronous
2828

29+
End-to-end asynchronous methods suffixed with `Async`.
30+
2931
When using the SQL Client, asychronous methods are available as well as `.ToTargetBlockAsync<T>(target)` and `.AsSourceBlockAsync<T>()` Dataflow methods.
3032

3133
## Extensions
@@ -49,14 +51,24 @@ var myResult = await cmd.ToListAsync(transform);
4951

5052
In order to keep connection open time to a minimum, some methods cache data before closing the connection and then subsequently applying the transformations as needed.
5153

52-
#### `Results<T>()`
54+
#### `Results<T>()` and `ResultsAsync<T>()`
5355

5456
Synchronously queries (pulls all the data). Then using the provided type `T` entity, the data is coerced by which properties intersect with the ones available to the ```IDataReader```.
5557

56-
#### `Retrieve()`
58+
#### `Retrieve()` and `RetrieveAsync()`
5759

5860
Synchronously queries (pulls all the data). Returns a `QueryResult<Queue<object[]>>` containing the requested data and column mappings. The `.AsDequeueingMappedEnumerable()` extension will iteratively convert the results to dictionaries for ease of access.
5961

6062
#### `AsSourceBlockAsync<T>()`
6163

6264
(Fully asynchronous.) Retuns a Dataflow source block. Then asynchronously buffers and transforms the results allowing for any possible Dataflow configuration. The source block is marked as complete when there are no more results. If the block is somehow marked as complete externally, the flow of data will stop and the connection will close.
65+
66+
### `AsSourceBlockAsync<T>()` versus `ResultsAsync<T>`
67+
68+
Depending on the level of asynchrony in your application, you may want to avoid too much buffering of data.
69+
70+
`AsSourceBlockAsync<T>()` is fully asynchronous from end-to-end and can keep total buffering to a minimum by consuming (receiving) results as fast as possible, but may incur additional latency between reads.
71+
72+
`ResultsAsync<T>()` is fully asynchronous from end-to-end but returns an `IEnumerable<T>` that although has fully buffered the all the data into memory, has deferred the transformation until enumerated. This way, the asynchronous data pipeline is fully complete before synchronously transforming the data.
73+
74+
Both methods ultimately are using a Queue<object[]> or ConcurrentQueue<object[]> (Dataflow) to buffer the data, but `ResultsAsync<T>()` buffers the entire data set before dequeuing and transforming the results.

0 commit comments

Comments
 (0)