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
+46-5Lines changed: 46 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,7 +12,7 @@ The provided expressive command classes allow for an expressive means to append
12
12
13
13
Extensions are provied to create commands from connection factories.
14
14
15
-
### Example
15
+
#####Example
16
16
17
17
```cs
18
18
varresult=connectionFactory
@@ -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,53 @@ 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>()`
55
+
56
+
Queues 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```.
57
+
58
+
Optionally a field to column override map can be passed as a parameter. If a column is set as `null` then that field is ignored (not applied to the model).
53
59
54
-
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```.
60
+
##### Examples
55
61
56
-
#### `Retrieve()`
62
+
If all the columns in the database map exactly to a field: (A column that has no associated field/property is ignored.)
63
+
```cs
64
+
varpeople=cmd.Results<Person>();
65
+
```
57
66
58
-
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.
Queuesallthedata. Returnsa `QueryResult<Queue<object[]>>` containingtherequesteddataandcolumninformation. The `.AsDequeueingMappedEnumerable()` extensionwilliterativelyconverttheresultstodictionariesforeaseofaccess.
59
90
60
91
#### `AsSourceBlockAsync<T>()`
61
92
62
93
(Fullyasynchronous.) RetunsaDataflowsourceblock. ThenasynchronouslybuffersandtransformstheresultsallowingforanypossibleDataflowconfiguration. Thesourceblockismarkedascomplete 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.
94
+
95
+
### `AsSourceBlockAsync<T>()` versus `ResultsAsync<T>`
Bothmethodsultimatelyareusinga `Queue<object[]>` or `ConcurrentQueue<object[]>` (Dataflow) tobufferthedata, but `ResultsAsync<T>()` bufferstheentiredatasetbeforedequeuingandtransformingtheresults.
0 commit comments