Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8730611
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T09:03:33+00:00 2026-06-13T09:03:33+00:00

At the moment I’m mapping my existing DB tables to new EF 4.5 model

  • 0

At the moment I’m mapping my existing DB tables to new EF 4.5 model via Fluent Api. I’ve got a questing on how to map following db structure to classes.

Students(pk Id...)
Courses (pk Id...)
Students_Courses (pk Id, fk StudentId, fk CourseId)
Comments (pk Id, fk Students_Courses Id, comment, dateposted...)

The idea is that I may have many reviews per student_course pair. What is the best way to represent my classes in this scenario?
The problem here is that I’ll probably need to map Comment entity to Students_Courses table and somehow determine to which Student and Course (in terms of classes) this comment belongs.
Any suggestions on the design?
Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T09:03:34+00:00Added an answer on June 13, 2026 at 9:03 am

    Maybe you’d like to use Entity Framework Power Tools to reverse-engineer your data model into a “code -first” model with DbContext API.

    You will see that something like a StudentCourse class will be generated that looks like this:

    public class StudentCourse
    {
        public StudentCourse()
        {
            this.Comments = new List<Comment>();
        }
    
        public int StudentCourseId { get; set; }
        public int StudentId { get; set; }
        public int CourseId { get; set; }
        public virtual ICollection<Comment> Comments { get; set; }
        public virtual Course Course { get; set; }
        public virtual Student Student { get; set; }
    }
    

    and Comment looking like this:

    public class Comment
    {
        public int CommentId { get; set; }
        public int StudentCourseId { get; set; }
        public virtual StudentCourse StudentCourse { get; set; }
        ...
    }
    

    So comments are related with students and courses through StudentCourse

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following set of tables in an existing database. Resource - ResourceID
Okay at the moment I my self am new to programming and learning it
I've just started using Linq and at the moment I've got a database ready
At the moment I am using the following code: public void init() { question
At the moment I have val orders = new HashMap[Int, Int] orders.put(36, 110) orders.put(35,
http://dev.epicwebdesign.ca/emco/assets/mapping.php That's loaded as an iFrame in http://dev.epicwebdesign.ca/emco/?page=dealerlocator . For some reason, the map
At the moment I use: map <C-F2> :set cursorcolumn<Bar>set cursorline<CR> map <C-F3> :set nocursorcolumn<Bar>set
i have the following function, which doe a basic job of mapping an lxml
At moment I want to implement picture upload without using any plug-ins. My upload
There is a moment in my app, that I need to force to show

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.