Question: Using any LINQ syntax, how would I create two LINQ queries and output their results to the console using this information? This code was created

Using any LINQ syntax, how would I create two LINQ queries and output their results to the console using this information? This code was created using C#.
[Table("Authors")]
public class Author
{
public int AuthorId { get; set; }
[MaxLength(50)]
public string FirstName { get; set; }
[MaxLength(50)]
public string LastName { get; set; }
public virtual List Bibliography { get; set; }
}
[Table("Books")]
public class Book
{
public int BookId { get; set; }
[MaxLength(50)]
public string IsbnNumber { get; set; }
[MaxLength(50)]
public string TitleName { get; set; }
public string AuthorName { get; set; }
public string GenreType { get; set; }
public int AuthorId { get; set; }
public virtual Author Writer { get; set; }
public virtual List Composition { get; set; }
}
[Table("Genres")]
public class Genre
{
public int GenreId { get; set; }
[MaxLength(50)]
public string GenreType { get; set; }
[MaxLength(50)]
public int BookId { get; set; }
public virtual Book Class { get; set; }
}
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
modelBuilder.Entity(). Both HasData(adf
new Author {AuthorId=1, FirstName="Mason", LastName="Kreitzer"},
new Author {AuthorId=2, FirstName="Isaac", LastName="Kreitzer"},
new Author {AuthorId=3, FirstName="Dylan", LastName="Kreitzer"},
new Author {AuthorId=4, FirstName="Liam", LastName="Kreitzer"},
new Author {AuthorId=5, FirstName="Scott", LastName="Kreitzer"}
);
modelBuilder.Entity().HasData(
new Book {BookId=1, IsbnNumber="9780007525508", TitleName="The Hobbit", AuthorName="John Tolkien", GenreType="Fantasy", AuthorId=5},
new Book {BookId=2, IsbnNumber="9780451075710", TitleName="Atlas Shrugged", AuthorName="Ayn Rand", GenreType="Science Fiction", AuthorId=3},
new Book {BookId=3, IsbnNumber="9780747546818", TitleName="The Complete Poetry of Edgar Allan Poe", AuthorName="Edgar Allan Poe", GenreType="Poetry", AuthorId=1},
new Book {BookId=4, IsbnNumber="9780307743671", TitleName="Salem's Lot", AuthorName="Stephen King", GenreType="Horror", AuthorId=3},
new Book {BookId=5, IsbnNumber="9788804397410", TitleName="Murder on the Orient Express", AuthorName="Agatha Christie", GenreType="Mystery", AuthorId=5}
);
modelBuilder.Entity().HasData(
new Genre {GenreId=1, GenreType="Fantasy", BookId=1},
new Genre {GenreId=2, GenreType="Poetry", BookId=3},
new Genre {GenreId=3, GenreType="Science Fiction", BookId=2},
new Genre {GenreId=4, GenreType="Horror", BookId=4},
new Genre {GenreId=5, GenreType="Mystery", BookId=5}
);
}
Both LINQ queries must return results from multiple tables!

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!