Skip to content

Instantly share code, notes, and snippets.

@nrazon
Forked from wayne-o/gist:1127489
Created April 1, 2012 13:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nrazon/2275303 to your computer and use it in GitHub Desktop.
Save nrazon/2275303 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