beginner Linq syntax and EF4 question
Posted
by
user564577
on Stack Overflow
See other posts from Stack Overflow
or by user564577
Published on 2011-01-08T01:20:38Z
Indexed on
2011/01/08
4:54 UTC
Read the original article
Hit count: 183
LINQ
|entity-framework-4
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!
© Stack Overflow or respective owner