Reputation: 11480
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>
.
Upvotes: 1
Views: 1855