Stacie
asked on
.MapRightKey
Trying to understand what the following code mean.... MapLeftKey???
Map(t => t.MapLeftKey("CourseID")
.MapRightKey("InstructorID ")
.ToTable("CourseInstructor "));
using ContosoUniversity.Models;
using System.Data.Entity;
using System.Data.Entity.ModelCo nfiguratio n.Conventi ons;
namespace ContosoUniversity.DAL
{
public class SchoolContext : DbContext
{
public DbSet<Course> Courses { get; set; }
public DbSet<Department> Departments { get; set; }
public DbSet<Enrollment> Enrollments { get; set; }
public DbSet<Instructor> Instructors { get; set; }
public DbSet<Student> Students { get; set; }
public DbSet<OfficeAssignment> OfficeAssignments { get; set; }
protected override void OnModelCreating(DbModelBui lder modelBuilder)
{
modelBuilder.Conventions.R emove<Plur alizingTab leNameConv ention>();
modelBuilder.Entity<Course >()
.HasMany(c => c.Instructors).WithMany(i => i.Courses)
.Map(t => t.MapLeftKey("CourseID")
.MapRightKey("InstructorID ")
.ToTable("CourseInstructor "));
}
}
}
Map(t => t.MapLeftKey("CourseID")
.MapRightKey("InstructorID
.ToTable("CourseInstructor
using ContosoUniversity.Models;
using System.Data.Entity;
using System.Data.Entity.ModelCo
namespace ContosoUniversity.DAL
{
public class SchoolContext : DbContext
{
public DbSet<Course> Courses { get; set; }
public DbSet<Department> Departments { get; set; }
public DbSet<Enrollment> Enrollments { get; set; }
public DbSet<Instructor> Instructors { get; set; }
public DbSet<Student> Students { get; set; }
public DbSet<OfficeAssignment> OfficeAssignments { get; set; }
protected override void OnModelCreating(DbModelBui
{
modelBuilder.Conventions.R
modelBuilder.Entity<Course
.HasMany(c => c.Instructors).WithMany(i => i.Courses)
.Map(t => t.MapLeftKey("CourseID")
.MapRightKey("InstructorID
.ToTable("CourseInstructor
}
}
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
.HasMany(c => c.Instructors).WithMany(i => i.Courses)
.Map(t => t.MapLeftKey("CourseID")
.MapRightKey("InstructorID
.ToTable("CourseInstructor
Does this actually create a table CourseInstructor?