I have following tables with composite primary keys (ID, Lang) and have many to many relation through CompanyCustomers table

modelBuilder.Entity<Company>(entity =>
{
entity.ToTable("Companies").HasKey(pk => new { pk.ID, pk.Lang });
});
modelBuilder.Entity<Customer>(entity =>
{
entity.ToTable("Customers").HasKey(pk => new { pk.ID, pk.Lang });
});
modelBuilder.Entity<CompanyCustomer>(entity =>
{
entity.ToTable("CompanyCustomers").HasKey(pk => new { pk.CompanyID, pk.CustomerID });
});
- How to configure many to many relation?
- How to write Linq (method syntax) to INNER join and return Customers of the company (following is method signature
public IEnumerable<Customer> GetCompanyCustomers(int companyId, string lang)
{
// var result = _db.Companies.Join(...).Select(s=> s.Customer).ToList();
}