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.
Can you answer this question?
Write Answer0 Answers