---
title: "Mapping complex nested Dapper results to C# objects"  
description: "Mapping complex nested Dapper results to C# objects"  
author: "John Smith"  
published: 2026-09-30  
updated: 2026-09-30  
canonical: https://www.mindstick.com/forum/162224/mapping-complex-nested-dapper-results-to-c-objects  
category: "Data Modeling"  
tags: ["Dapper", "Mapping", "sql", "c#", "data modeling"]  
reading_time: 1 minute  

---

# Mapping complex nested Dapper results to C# objects

I'm struggling with a query that returns a parent row and a variable number of child rows in a single flat result set. Dapper is great for simple 1:1 mappings, but here I need to group children under their parent dynamically.

For example, a `Departments` table joined to `Employees` where each department has zero or more employees. I don't want to run N+1 queries. My first thought was to use multiple result sets, but my SQL only returns one.

What patterns do people use? I've seen references to custom multi-mapping with `Query<T, U, T>`, but the syntax looks intimidating. Is there a cleaner way, perhaps by splitting the flat list in memory after a single query?

If someone could share a minimal working example of splitting a flat Dapper result into a parent-child hierarchy, that would save me hours of trial and error.


---

Original Source: https://www.mindstick.com/forum/162224/mapping-complex-nested-dapper-results-to-c-objects

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
