Nirman
Nirman

Reputation: 6793

Linq to Entities - JOIN a list with an entity set

I am able to join a list (collection) with an entity set using listname.Join() method.

For example,

var query = listName.Join(repository.GetQuery<MyCustomType>(),
 list => list.CustomTypeId,
 customType => customType.id,
 (list, customType) => list); 

This is working fine, but it returns only rows related to list collection in the entity. I also want instance of "MyCustomType" in resultset. How do I achieve this?

Upvotes: 0

Views: 2363

Answers (1)

Paul Fleming
Paul Fleming

Reputation: 24526

var query = listName.Join(repository.GetQuery<MyCustomType>(),
 list => list.CustomTypeId,
 customType => customType.id,
 (list, customType) => new { l = list, c = customType } ); 

Upvotes: 2

Related Questions