Migration: How to Migrate Transformers from 3.x

Transformers were removed and substituted by a server-side projection support. Methods like TransformWith are no longer available and simple Select should be used instead.

We encourage you to read our article that covers the projection functionality which can be found here.

Example

3.x
public class Orders_Total : AbstractTransformerCreationTask<Order>
{
    public class Result
    {
        public double Total { get; set; }
    }

    public Orders_Total()
    {
        TransformResults = orders => 
            from o in orders
            select new
            {
                Total = o.Lines.Sum(l => l.PricePerUnit * l.Quantity)
            };
    }
}
List<Orders_Total.Result> results = session
    .Query<Order>()
    .TransformWith<Orders_Total, Orders_Total.Result>()
    .ToList();
4.0
var results = session
    .Query<Order>()
    .Select(x => new
    {
        Total = x.Lines.Sum(l => l.PricePerUnit * l.Quantity),
    })
    .ToList();

Do you need any help with Migration?