I have a Post
class with a User
property in it. When I try to get all Posts, I also want to map the User
to a UserDto
object.
public class Post {
public Guid Id {get; set;}
public string Content {get;set;}
public User User {get; set;}
}
var result = await _ctx.Posts.Include(u => u.User.Adapt<UserDto>()).ToListAsync()
Adapting inside the Include
is throwing this error:
Lambda expression used inside Include is not valid