Page 1 of 1

LoadWith()

Posted: Mon 02 Nov 2009 10:19
Hello

I have the following query:

Code: Select all

from rc in MyDB.ReplicationCategories.LoadWith(rc => rc.Category)
select rc;
Each ReplicationCategory references exactly one Category which will be also loaded with the above query.

So far so good. Now, each category has n translations which I would like to load too:

Code: Select all

from rc in MyDB.ReplicationCategories.LoadWith(rc => rc.Category.LoadWith(c => c.CategoryTranslations))
select rc;
Unfortunately I got the error message "Category does not contain a definition for 'LoadWith'". Why isn't this method exposed there?

Best regards
________
STARCRAFT II REPLAYS

Posted: Tue 03 Nov 2009 09:43
by AndreyR
This is designed behaviour, the Category class instance does not contain any definition for the
LoadWith method, it is EntitySet-level method.
This code should help:

Code: Select all

from rc in MyDB.ReplicationCategories.LoadWith(rc => rc.Category).LoadWith("Category.CategoryTranslations") 
select rc;