Skip to content

Instantly share code, notes, and snippets.

@wayne-o
Created August 5, 2011 12:58
Show Gist options
  • Save wayne-o/1127489 to your computer and use it in GitHub Desktop.
Save wayne-o/1127489 to your computer and use it in GitHub Desktop.
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