Created
August 5, 2011 12:58
-
-
Save wayne-o/1127489 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class InviteList_Hydrated : AbstractIndexCreationTask<InviteList> | |
{ | |
public InviteList_Hydrated() | |
{ | |
Map = docs => from doc in docs select new { doc.Name, doc.Site.Id }; | |
TransformResults = (db, docs) => from doc in docs | |
let Households = ( | |
from hh in doc.Households | |
let household = db.Load<Archant.Wedding.Areas.AddressBook.Models.Household>(hh.Id) | |
let PrimaryContact = db.Load<PrimaryContact>(household.PrimaryContact.Id) | |
let Partner = db.Load<Partner>(household.Partner.Id) | |
let Children = db.Load<Child>((from c in household.Children select c.Id).ToList()) | |
select new | |
{ | |
household.Id, | |
household.Name, | |
PrimaryContact, | |
Partner, | |
Children | |
}) | |
let Site = db.Load<Site>(doc.Site.Id) | |
select new | |
{ | |
doc.Deleted, | |
Households, | |
doc.Id, | |
doc.Name, | |
Site | |
}; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment