New Posts New Posts RSS Feed: Include keyword  - Get All!
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

Include keyword - Get All!

 Post Reply Post Reply
Author
sbelini View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 13-Aug-2010
Location: Oakland
Posts: 786
Post Options Post Options   Quote sbelini Quote  Post ReplyReply Direct Link To This Post Topic: Include keyword - Get All!
    Posted: 16-Sep-2010 at 10:26am

You mention:

"This returns the one city for that address."
 
If there is only one city related to the entities satisfying Address, you will only get one. (Should there be more?)
 
As for your question:
"how do I return all the cities as part of a eager load..."
 
you can use.
 
EntityManager.Cities.Execute();
 
and thereafter refer to a cacheonly query to retrieve the cities. Or even:
 
"and store it as a property on the Address object."
 
not sure what you mean here. Can you clarify?
 
"I want to use this property to databind a combobox itemssource in a datagrid for user selection."
 
var cities = EntityManager.Cities.Execute();
comboBox.ItemSource = cities;
 
I hope this helps.
Back to Top
Jakes View Drop Down
Newbie
Newbie
Avatar

Joined: 25-Jun-2010
Location: South Africa
Posts: 6
Post Options Post Options   Quote Jakes Quote  Post ReplyReply Direct Link To This Post Posted: 15-Sep-2010 at 6:38am
I have a query where I use the "Include" keyword to include a navigation property as so:

Address.Include("Cities");

This returns the one city for that address.

My question is, how do I return all the cities as part of a eager load and store it as a property on the Address object. 

I want to use this property to databind a combobox itemssource in a datagrid for user selection.

Thanks in advance.
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down