Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Let's say I have the model: public class Student { int StudentID {get;set;} string FirstName {get;set;} string LastName {get;set;} ICollection courses = {get; set;} }

Let's say I have the model:

public class Student {

int StudentID {get;set;}

string FirstName {get;set;}

string LastName {get;set;}

ICollection courses = {get; set;}

}

Another Model:

public class Course{

int CourseID {get;set;}

string CourseName {get;set;}

string CreditHours {get;set;}

}

One more Model

public class StudentCourse{

int StudentCourseID {get;set;}

int StudentID {get;set;}

int CourseID {get;set;}

}

Now I add a bunch of data to the database...

and the relationship between student to course (one to many) is lost.

That is now I only have three data tables based on the models above in the database

with no relationship between them whatsoever.

If I create another application, write 3 models matching exactly as the models above and define the one to many relationship between

student and course using fluent API, will that work? That is will I be able to relate the data that already exists?

For example,

After doing the step above and querying a list of student and doing student.courses.ToList(); will it return the list of courses for the particular student based on what is in the database already?

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

Step: 3

blur-text-image

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

Database Processing

Authors: David M. Kroenke

12th Edition International Edition

1292023422, 978-1292023427

More Books

Students also viewed these Databases questions

Question

1. What is meant by Latitudes? 2. What is cartography ?

Answered: 1 week ago

Question

What is order of reaction? Explain with example?

Answered: 1 week ago