c# - Mapping 4 tables in Entity Framework using Fluent API -
i having difficulties in creating custom mapping table in ef6.
i have 4 tables:
- student
- instructor
- questions
- course
what want create table include primary keys of 4 tables , add score column it.
what command should use in entity framework fluent api?
this classes have created
public class student { public student() { this.courses = new hashset<course>(); } public int studentid { get; set; } public string lastname { get; set; } public string firstmidname { get; set; } public virtual icollection<course> courses { get; set; } } public class instructor { public instructor() { this.courses = new hashset<course>(); } public int instructorid { get; set; } public string lastname { get; set; } public string firstmidname { get; set; } public virtual icollection<course> courses { get; set; } } public class course { public course() { this.instructors = new hashset<instructor>(); this.students = new hashset<student>(); } public int courseid { get; set; } public string title { get; set; } public string description { get; set; } public virtual icollection<instructor> instructors { get; set; } public virtual icollection<student> students { get; set; } } public class question { public int questionid { get; set; } public string description { get; set; } public int categoryid { get; set; } public category category { get; set; } }
Comments
Post a Comment