How I can read Parent - Child DataSet into object structure (If it possible)
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 18.4k
- Forks
- 3.7k
- Avg merge
- 5h 8m
- Merged PRs (30d)
- 1
Description
Hello. I'm beginner and don't know fuctionality of this great component.
Can someone help me with reading data to object model
public class Order
{
public int OrderId { get; set; }
public DateTime Date { get; set; }
public List<Detail> Details { get; set; }
}
public class Detail
{
public int OrderId { get; set; }
public string Product { get; set; }
}
SELECT O.OrderId, O.DateTime, D.Product
FROM Orders O
INNER JOIN Details D ON D.OrderId=O.OrderId
May be I should do so?
var x = multi.Read<Order, Detail, Order>((o, d) => { o.Details.Add(d); return o; }, splitOn:"OrderId");
But it returns in collection duplicate records
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
Review the Order and Detail models, joined SQL query, and proposed multi.Read<Order, Detail, Order> call with splitOn:"OrderId". Start with Dapper's multi-mapping documentation and examples; done means clarifying how the joined rows should map into the object structure and why duplicate records appear.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp, sql
- Domain
- backend, database
- Issue type
- Documentation
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100