DapperLib / DapperLib/Dapper

V2: What should the API look like for horizontally mapped data via tuples?

Open
#745 7 comments 5 reactions 1 assignee View on GitHub

@mgravell is already working on this.

Since Apr 21, 2017.

enhancement proposal v3.0
Dominant language
C#
Stars
18.4k
Forks
3.7k
Avg merge
5h 8m
Merged PRs (30d)
1

Description

Historically, we have the multi-generic Query<T1,T2, ... ,TResult> API for this which is ugly as sin and clunky to use.

We have an opportunity to improve things using tuples, with the nice advantage that since tuples are only one T (for any reasonable number of partitions), it won't cause overload explosion. Long term, this might even be seen as a replacement to the Query<T1,T2, ..., TResult> API (in a breaking major, etc).

I've thrown some early ideas into a branch; I want to invite feedback, or other original ideas - it is entirely possible that I'm missing an obvious + better way of doing this!

Again, the target scenario here is when you're selecting from multiple tables in one horizontal piece, and want to access the pieces into separate DTOs - in SQL terms:

select c.*, a.*
from Customer c
inner join CustomerAddresses ca on ca.CustomerId = c.Id
inner join Address a on a.Id = ca.AddressId

which is going to return a bunch of columns that we want to map (for each row) into a Customer object and an Address object.

Note: the discussion of what to do for duplicated Address records or Customer records (same Id, multiple instances vs single instance) is separate - please don't get distracted by that aspect (although that's also something we'd like to improve at a later data)

Here are a lot of examples in that test branch

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.