Let's take simple index from RavenDb documentation as an example:
public class SampleIndex : AbstractIndexCreationTask<Invoice>
{
public SampleIndex()
{
Map = invoices => from invoice in invoices
select new
{
CustomerId = invoice.CustomerId,
CustomerName = LoadDocument<Customer>(invoice.CustomerId).Name
};
}
}
Let's assume I need to have multiple customer properties in the index or transformer. Should I call LoadDocument<Customer>(invoice.CustomerId).SomeProperty
every time (may be RavenDb optimizes it and actually load document once) or is there any special syntax (similar to let
in LINQ)?