You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+14-2Lines changed: 14 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -26,6 +26,8 @@ var result = connectionFactory
26
26
27
27
## Asynchronous
28
28
29
+
End-to-end asynchronous methods suffixed with `Async`.
30
+
29
31
When using the SQL Client, asychronous methods are available as well as `.ToTargetBlockAsync<T>(target)` and `.AsSourceBlockAsync<T>()` Dataflow methods.
30
32
31
33
## Extensions
@@ -49,14 +51,24 @@ var myResult = await cmd.ToListAsync(transform);
49
51
50
52
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.
51
53
52
-
#### `Results<T>()`
54
+
#### `Results<T>()` and `ResultsAsync<T>()`
53
55
54
56
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```.
55
57
56
-
#### `Retrieve()`
58
+
#### `Retrieve()` and `RetrieveAsync()`
57
59
58
60
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.
59
61
60
62
#### `AsSourceBlockAsync<T>()`
61
63
62
64
(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