Dapper joins in Entity Framework style objects
Dapper and joins
Given a table called Author:

and a table called books:

and we have these 3 classes:
// Could also be a class with get;set; properties
public record AuthorWithBooks
{
public Author Author { get; init; }
public IReadOnlyList<Book> Books { get; init; }
}
public record Author
{
public int AuthorId { get; init; }
public string FirstName { get; init; }
public string FamilyName { get; init; }
}
public record Book
{
public int BookId { get; init; }
public string Title { get; init; }
public string Color { get; init; }
}
I could not found simple example have list of tuples where each tuple has 1 author and a list of books. I found an example ath the Dapper siteDapper multi mapping.,
but that a book that has a reference to an author. Just like in the database, but I want it object oriented: the author has a list of books.
That is why I put an simple example of an object oriented style in this blog post.