Skip to content
This repository was archived by the owner on Dec 24, 2022. It is now read-only.

Commit fd33a39

Browse files
committed
move dynamic result sets under select multiple columns
1 parent cb739b8 commit fd33a39

File tree

1 file changed

+45
-45
lines changed

1 file changed

+45
-45
lines changed

README.md

Lines changed: 45 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -182,51 +182,6 @@ We've also added a
182182
as it's a common use-case to swapout to use Sqlite's in-memory provider for faster tests.
183183
But as Sqlite doesn't provide async API's under-the-hood we fallback to *pseudo async* support where we just wrap its synchronous responses in `Task` results.
184184

185-
## Dynamic Result Sets
186-
187-
There's new support for returning unstructured resultsets letting you Select `List<object>` instead of having results mapped to a concrete Poco class, e.g:
188-
189-
```csharp
190-
db.Select<List<object>>(db.From<Poco>()
191-
.Select("COUNT(*), MIN(Id), MAX(Id)"))[0].PrintDump();
192-
```
193-
194-
Output of objects in the returned `List<object>`:
195-
196-
[
197-
10,
198-
1,
199-
10
200-
]
201-
202-
You can also Select `Dictionary<string,object>` to return a dictionary of column names mapped with their values, e.g:
203-
204-
```csharp
205-
db.Select<Dictionary<string,object>>(db.From<Poco>()
206-
.Select("COUNT(*) Total, MIN(Id) MinId, MAX(Id) MaxId"))[0].PrintDump();
207-
```
208-
209-
Output of objects in the returned `Dictionary<string,object>`:
210-
211-
{
212-
Total: 10,
213-
MinId: 1,
214-
MaxId: 10
215-
}
216-
217-
and can be used for API's returning a **Single** row result:
218-
219-
```csharp
220-
db.Single<List<object>>(db.From<Poco>()
221-
.Select("COUNT(*) Total, MIN(Id) MinId, MAX(Id) MaxId")).PrintDump();
222-
```
223-
224-
or use `object` to fetch an unknown **Scalar** value:
225-
226-
```csharp
227-
object result = db.Scalar<object>(db.From<Poco>().Select(x => x.Id));
228-
```
229-
230185
## Nested Typed Sub SqlExpressions
231186

232187
The `Sql.In()` API supports nesting and combining of multiple Typed SQL Expressions together
@@ -865,6 +820,51 @@ The mapping also includes a fallback for referencing fully-qualified names in th
865820
- `CustomerName` => "Customer"."Name"
866821
- `OrderCost` => "Order"."Cost"
867822

823+
## Dynamic Result Sets
824+
825+
There's new support for returning unstructured resultsets letting you Select `List<object>` instead of having results mapped to a concrete Poco class, e.g:
826+
827+
```csharp
828+
db.Select<List<object>>(db.From<Poco>()
829+
.Select("COUNT(*), MIN(Id), MAX(Id)"))[0].PrintDump();
830+
```
831+
832+
Output of objects in the returned `List<object>`:
833+
834+
[
835+
10,
836+
1,
837+
10
838+
]
839+
840+
You can also Select `Dictionary<string,object>` to return a dictionary of column names mapped with their values, e.g:
841+
842+
```csharp
843+
db.Select<Dictionary<string,object>>(db.From<Poco>()
844+
.Select("COUNT(*) Total, MIN(Id) MinId, MAX(Id) MaxId"))[0].PrintDump();
845+
```
846+
847+
Output of objects in the returned `Dictionary<string,object>`:
848+
849+
{
850+
Total: 10,
851+
MinId: 1,
852+
MaxId: 10
853+
}
854+
855+
and can be used for API's returning a **Single** row result:
856+
857+
```csharp
858+
db.Single<List<object>>(db.From<Poco>()
859+
.Select("COUNT(*) Total, MIN(Id) MinId, MAX(Id) MaxId")).PrintDump();
860+
```
861+
862+
or use `object` to fetch an unknown **Scalar** value:
863+
864+
```csharp
865+
object result = db.Scalar<object>(db.From<Poco>().Select(x => x.Id));
866+
```
867+
868868
### Select data from multiple tables into Dynamic ResultSets
869869

870870
You can also select data from multiple tables into

0 commit comments

Comments
 (0)