I have a table called Company which has a 1...* relationship to a Branch table. When I run the following I notice that two statements are executed on the SQL Server rather than a statement with an INNER JOIN. The first statement is to retrieve the Company entity and the second for the Branch entities.
FetchStrategy fetchStrategy =
fetchStrategy.LoadWith<Company>( entity => entity.Branches );
Company company = ( from c
_domainModel.Companies.LoadWith( fetchStrategy )
select c ).FirstOrDefault();
Debug.WriteLine( company.Branches[ 0 ].Name );
If I leave out the FirstOrDefault and enumerate through the results, then I get a single query sent to the server with the INNER JOIN. Am I missing/forgeting something or is this working they way it should?