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
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 Topic: Include keyword - Get All
    Posted: 15-Sep-2010 at 11:27pm
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 created by IdeaBlade. 

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

Thanks in advance.
Back to Top
jcrada View Drop Down
Newbie
Newbie
Avatar

Joined: 03-Sep-2010
Location: Bogota
Posts: 6
Post Options Post Options   Quote jcrada Quote  Post ReplyReply Direct Link To This Post Posted: 16-Sep-2010 at 12:29pm
I have used extension methods (http://msdn.microsoft.com/en-us/library/bb383977.aspx) for the entity manager then at the begining of my application I load the content of the citites table in asynchronous query, then when the user use the combobox the query is ready and my method return the items source getCities , in the worst case scenario the query will not be ready and the user must have to wait

public static class EntityManagerExtension
{
public static void LoadDataBaseObjects(this EntityManager manager) 
{
var citites =  manager.GetQuery<City>();
manager.ExecuteQueryAsync(citites);
                }

public static IEnumerable<City> getCities(this EntityManager manager) 
{
var citites =  manager.GetQuery<City>();
return manager.ExecuteQuery(citites);
}

Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down