I have two entities with many to many relationship like this:
class author
{
public int AuthorID{get;set;}
public string Name{get;set;}
public virtual ICol
This was problematic with EDMX but with EF 4.1 fluent API you can map it:
modelBuilder.Entity()
.HasMany(b => b.authors)
.WithMany(a => a.books)
.Map(m => m.MapLeftKey("BookID")
.MapRightKey("AuthorID")
.ToTable("BookAuthor"));
As you can see I don't map BookAuthor
column. That column is unknown to EF and must be auto incremented.
This obviously can't work with a Code-first approach but only if you use Fluent API against existing database.