beginner Linq syntax and EF4 question
- by user564577
Question
With the following linq code snip I get a list of clients with address filtered by the specifications but the form of the entities returned is not what i had expected.
The data is 1 client with 2 addresses and 1 client with 1 address.
The query returns 3 rows of clients each with 1 address
Client 1 = Address1
Client 1 = Address2
Client 2 = Address3
var query = from t1 in context.Clients.Where(specification.SatisfiedBy()).Include("ClientAddresses")
join t2 in context.ClientAddresses.Where(spec.SatisfiedBy())
on t1.ClientKey equals t2.ClientKey
select t1;
My expectation was a little more like a list with only two clients in it, one client with a collection of two addresses and one client with a collection of one address.
Client 1 = Address1 / Address2
Client 2 = Address3
What am I missing???
Thanks!