Solved

Entity Framework - Many to Many relations, query the foreign keys

Posted on 2016-09-07
3
56 Views
Last Modified: 2016-09-15
Looking at http://www.entityframeworktutorial.net/code-first/configure-many-to-many-relationship-in-code-first.aspx, there is generated a table between Course and Students called CourseStudents. How would I go about manipulating and querying that table for information on relations between Course and Students?
0
Comment
Question by:itnifl
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 44

Expert Comment

by:AndyAinscow
ID: 41787626
re:  https://www.experts-exchange.com/questions/28968035/Entity-Framework-Code-first-Specify-minimum-one-cardinality-in-a-many-to-many-relation.html#a41787558

In your link above that is doing what I suggested in your previous question.  An intermediate table with two 1:n relationships.

To use it.  Well you can make a query to show all the courses a student has visited, or all the students that visit a course....
0
 
LVL 2

Accepted Solution

by:
itnifl earned 0 total points
ID: 41787749
Yes, that is true. But I don't see how the cardinality is enforced there in entity framework.
Thanks for the reply, but this answer should have been in the other thread at https://www.experts-exchange.com/questions/28968035/Entity-Framework-Code-first-Specify-minimum-one-cardinality-in-a-many-to-many-relation.html#a41787558 or else we mix things up.

On the topic of this thread, I think the following was a good explanation:
http://stackoverflow.com/questions/4253165/insert-update-many-to-many-entity-framework-how-do-i-do-it
0
 
LVL 2

Author Closing Comment

by:itnifl
ID: 41799416
0

Featured Post

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
The purpose of this video is to demonstrate how to set up the WordPress backend so that each page automatically generates a Mailchimp signup form in the sidebar. This will be demonstrated using a Windows 8 PC. Tools Used are Photoshop, Awesome…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

617 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question