Answered step by step
Verified Expert Solution
Link Copied!

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#.
[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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Machine Learning And Knowledge Discovery In Databases European Conference Ecml Pkdd 2016 Riva Del Garda Italy September 19 23 2016 Proceedings Part 1 Lnai 9851

Authors: Paolo Frasconi ,Niels Landwehr ,Giuseppe Manco ,Jilles Vreeken

1st Edition

3319461273, 978-3319461274

More Books

Students also viewed these Databases questions

Question

Is there a clear hierarchy of points in my outline?

Answered: 1 week ago