modelBuilder.Entity<Account>()
.HasMany(a => a.Products)
.WithMany()
.Map(x =>
{
x.MapLeftKey("Account_Id");
x.MapRightKey("Product_Id");
x.ToTable("AccountProducts");
});
More Related Contents:
- Unique key with EF code first
- Ignoring a class property in Entity Framework 4.1 Code First
- EF Code First: How to get random rows
- Overriding SaveChanges and setting ModifiedDate, but how do I set ModifiedBy?
- EF Code First – how to set identity seed?
- Navigation Property without Declaring Foreign Key
- An error occurred while saving entities that do not expose foreign key properties for their relationships
- Validation failed for one or more entities. See ‘EntityValidationErrors’ property for more details [duplicate]
- Entity Framework Code First – two Foreign Keys from same table
- Decimal precision and scale in EF Code First
- Entity Framework Stored Procedure Table Value Parameter
- How can I automatically filter out soft deleted entities with Entity Framework?
- composite key as foreign key
- Implementing Zero Or One to Zero Or One relationship in EF Code first by Fluent API
- EF Code-First One-to-one relationship: Multiplicity is not valid in Role * in relationship
- Many-to-many mapping table
- One to one optional relationship using Entity Framework Fluent API
- Why is inserting entities in EF 4.1 so slow compared to ObjectContext?
- How to disable cascade delete for link tables in EF code-first?
- Entity framework, problems updating related objects
- Exclude a field/property from the database with Entity Framework 4 & Code-First
- Entity Framework creates a plural table name, but the view expects a singular table name?
- Entity Framework 4.1 InverseProperty Attribute and ForeignKey
- Entity Framework Code First Date field creation
- Entity Framework Code First naming conventions – back to plural table names?
- How should I set up my integration tests to use a test database with Entity Framework?
- Entity Framework 4.1 DbSet Reload
- How should I access a computed column in Entity Framework Code First?
- Modelling polymorphic associations database-first vs code-first
- How can set a default value constraint with Entity Framework 6 Code First?