Users Pricing

forum

Home Forums Why does my Dapper multi-mapping leave the parent object null? – MindStick

Why does my Dapper multi-mapping leave the parent object null?

Austin Dcruz 92 30 Sep 2026

I'm trying to pull back a list of Order records where each one carries a nested Customer object. I'm using Dapper's Query<Order, Customer, Order> overload, but no matter what I do, the Customer properties stay null after materialization.

Here's the mapper I've been using:

// Mapper attempt
private Order MapOrder(Order order, Customer customer)
{
    order.Customer = customer; // Never sticks
    return order;
}

I've double-checked the splitOn column against my SELECT list and it lines up. The query itself returns rows fine in SSMS. Is there a registration step I'm missing, or does the overload signature need to change? I'd appreciate any patterns that keep the parent populated without bloating the result set.


0 Answers

Markdown for AI

A clean, structured version of this page for AI assistants and LLMs.

Open .md