ravendb/ravendb — pull request #505 by robashton (2013-02-12 11:11:22+00:00)
Title: Feature - Results transformers

Current stab looks something like

public class OrderWithProductInformation : AbstractResultsTransformer
{
public class Result
{
public string OrderId { get; set; }
public string ProductId { get; set; }
public string CustomerId { get; set; }
public string ProductName { get; set; }
}
public OrderWithProductInformation()
{
TransformResults = (database, orders) => from doc in orders
from productid in doc.ProductIds
let product = database.Load(productid)
select new
{
OrderId = doc.Id,
ProductId = product.Id,
ProductName = product.Name
};
}
}

With

var results = session.Query()
.Customize(x => x.WaitForNonStaleResults())
.Where(order => order.CustomerId == "customers/bob")
.TransformWith()
.ToList();

We can argue over exact semantics once the first test passes - obviously *not ready for merge*