Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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#
TableAuthors
public class Author
public int AuthorId get; set;
MaxLength
public string FirstName get; set;
MaxLength
public string LastName get; set;
public virtual List Bibliography get; set;
TableBooks
public class Book
public int BookId get; set;
MaxLength
public string IsbnNumber get; set;
MaxLength
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;
TableGenres
public class Genre
public int GenreId get; set;
MaxLength
public string GenreType get; set;
MaxLength
public int BookId get; set;
public virtual Book Class get; set;
protected override void OnModelCreatingModelBuilder modelBuilder
modelBuilder.Entity Both HasDataadf
new Author AuthorId FirstName"Mason", LastName"Kreitzer"
new Author AuthorId FirstName"Isaac", LastName"Kreitzer"
new Author AuthorId FirstName"Dylan", LastName"Kreitzer"
new Author AuthorId FirstName"Liam", LastName"Kreitzer"
new Author AuthorId FirstName"Scott", LastName"Kreitzer"
;
modelBuilder.EntityHasData
new Book BookId IsbnNumber TitleName"The Hobbit", AuthorName"John Tolkien", GenreType"Fantasy", AuthorId
new Book BookId IsbnNumber TitleName"Atlas Shrugged", AuthorName"Ayn Rand", GenreType"Science Fiction", AuthorId
new Book BookId IsbnNumber TitleName"The Complete Poetry of Edgar Allan Poe", AuthorName"Edgar Allan Poe", GenreType"Poetry", AuthorId
new Book BookId IsbnNumber TitleName"Salem's Lot", AuthorName"Stephen King", GenreType"Horror", AuthorId
new Book BookId IsbnNumber TitleName"Murder on the Orient Express", AuthorName"Agatha Christie", GenreType"Mystery", AuthorId
;
modelBuilder.EntityHasData
new Genre GenreId GenreType"Fantasy", BookId
new Genre GenreId GenreType"Poetry", BookId
new Genre GenreId GenreType"Science Fiction", BookId
new Genre GenreId GenreType"Horror", BookId
new Genre GenreId GenreType"Mystery", BookId
;
Both LINQ queries must return results from multiple tables!
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started