1

Inside the Dapper documentation I can clearly see the multi-mapping for a semi-simple object or simple object. For instance:

public class Post { public int Id { get; set; } public string Name { get; set; } public User Owner { get; set; } } public class User { public int Id { get; set; } public string Name { get; set; } } IDbConnection.QueryAsync<Post, User, Post>(query, (post, user) => { post.Owner = user; return post; }, new { Id = id }, null, true, "id", CommandType.Text); 

The question, is how to have Dapper handle more complex objects that have more than one inner object. For instance:

public class PlotStemDomain { public int Id { get; set; } ... public PlotDomain Plot { get; set; } public SpeciesDomain species { get; set; } } public class PlotDomain { public int Id { get; set; } ... } public class SpeciesDomain { public int Id { get; set; } ... } 

When it appears to only handle a single Func<Post, User, Post>.

1 Answer 1

1

Out of the box Dapper's Multi-Mapping supports about 7 objects to be mapped. An alternative, is to use QueryMultiple. See this thread for an example, it is very similar...

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.