У меня есть следующие классы и схема БД. Я пытаюсь запросить эти данные из базы данных с помощью dapper, который бы гидратировал полный граф объекта. Я просмотрел различные вопросы SO и тест, но не мог понять, как это сделать.
Author
-AuthorId
-Name
Post
-PostId
-Content
-AuthorId
Comment
-PostId
-CommentId
-Content
Tag
-PostId
-TagId
-Name
public class Author
{
public int AuthorId { get; set; }
public string Name { get; set; }
}
public class Tag
{
public int PostId { get; set; }
public int TagId { get; set; }
public string Name { get; set; }
}
public class Post
{
public int PostId { get; set; }
public string Content { get; set; }
public int AuthorId { get; set; }
public List<Tag> Tags { get; set; }
public List<Comment> Comments { get; set; }
public Author Author { get; set; }
public Post()
{
this.Comments = new List<Comment>();
this.Tags = new List<Tag>();
}
}
public class Comment
{
public int PostId { get; set; }
public int CommentId { get; set; }
public string Content { get; set; }
}