Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 9th, 2012  |  syntax: None  |  size: 1.22 KB  |  hits: 17  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. RavenDB - Get IDs of root property within a non-root level property
  2. IEnumerable<ApplicationServer> appServers = QueryAndCacheEtags(session =>
  3.   session.Advanced.LuceneQuery<ApplicationServer>()
  4.   .Include(x => x.CustomVariableGroupIds)
  5.   // This is the line I'm trying to make work:
  6.   .Include(x => (from item in x.ApplicationsWithOverrideGroup select item.ApplicationId).ToList())
  7.   ).Cast<ApplicationServer>();
  8.        
  9. .Include(x => x.ApplicationsWithOverrideGroup)
  10.        
  11. .Include(x => x.ApplicationsWithOverrideGroup[0].ApplicationId)
  12.        
  13. // Not using this, at least for now, because it increased the NumberOfRequests on the session...
  14. appServer.CustomVariableGroups = new ObservableCollection<CustomVariableGroup>(
  15. QueryAndCacheEtags(session => session.Load<CustomVariableGroup>(appServer.CustomVariableGroupIds)).Cast<CustomVariableGroup>());
  16.        
  17. // ... however, this kept the NumberOfRequests to just one. Not sure why the difference.
  18. appServer.CustomVariableGroups = new ObservableCollection<CustomVariableGroup>();
  19. foreach (string groupId in appServer.CustomVariableGroupIds)
  20. {                
  21.   appServer.CustomVariableGroups.Add(QuerySingleResultAndCacheEtag(session => session.Load<CustomVariableGroup>(groupId)) as CustomVariableGroup);
  22. }