Using Multi-Mapping type[] parameter with QueryUnbufferedAsync
Open
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 18.4k
- Forks
- 3.7k
- Avg merge
- 5h 8m
- Merged PRs (30d)
- 1
Description
Does an overload exist to use the type[] parameter for the QueryUnbufferedAsync overload? My goal is to have QueryUnbufferedAsync work similarly to QueryAsync when specifying a collection of types. Something like this:
var query = "SELECT * FROM Customers C JOIN Addresses A ON C.ID = A.CustomerID";
using var connection = connectionFactory.GetConnection();
//Currently possible
var customers = await connection.QueryAsync<Customer>(query, new Type[] { typeof(Customer), typeof(Address) }, (row) =>
{
var customer = (Customer)row[0];
customer.Address = (Address)row[1];
return customer;
});
return customers;
//Would like to do this:
await foreach(var customer in connection.QueryUnbufferedAsync<Customer>(query, new Type[] { typeof(Customer), typeof(Address) }, (row) =>
{
var customer = (Customer)row[0];
customer.Address = (Address)row[1];
return customer;
}))
{
yield return customer;
}
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
The relevant entry points are QueryUnbufferedAsync and QueryAsync; compare their overloads and multi-mapping signatures first. Done means QueryUnbufferedAsync accepts the type[] and mapping callback shown and supports the requested async iteration pattern, with coverage for that usage.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp, sql
- Domain
- backend-api-design, databases
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100