I have an application that has the following hierarchy - Locations --> Buildings --> Rooms --> Assets. I am creating a datagrid with all assets and need to display the room, building, location as well. Currently, I am having issues getting the Building and Location when I populate assets. I was able to get the Room data using the Include method on my query. Here is my code snippet.
private
void LoadData()
{
// _mgr.ExecuteQueryAsync(_mgr.Rooms, GotRooms, null);
// _mgr.ExecuteQueryAsync(_mgr.Buildings, GotBuildings, null);
_mgr.ExecuteQueryAsync(_mgr.Assets.Include(
"Room"), GotAssets, null);
}
private void GotAssets(EntityFetchedEventArgs args)
{
if (args.Error != null)
{
WriteMessage(args.Error.Message);
}
else
{
foreach (Asset asset in args.Result)
{
_assets.Add(asset);
}
}
}