I am in the process of implementing an entity framework and code-first technique using Fluent API.
I already have a mapping for one table:
modelBuilder.Entity<Certificate>()
.HasMany( c => c.Employees ).WithMany( e => e.Certificates )
.Map( m => {
m.ToTable( "Employee_Certificate" );
m.MapLeftKey( "CertificateId" );
m.MapRightKey( "EmployeeId" );
} );
What I was wondering is if I need to do an equivalent mapping for the Employee Entity as well?
Something like:
modelBuilder.Entity<Employee>()
.HasMany( e => e.Certificates ).WithMany( c => c.Employees )
.Map( m => {
m.ToTable( "Employee_Certificate" );
m.MapLeftKey( "EmployeeId" );
m.MapRightKey( "CertificateId" );
} );
or will a simple HasMany(...).WithMany(...)
be good enough?