1

Is it possible to get just the mapping expression, i.e., an object of type System.Linq.Expressions.Expression<Func<TSource, TTarget>>? I would like to manually pass it to a Select-like function accepting an expression.

gius
  • 9,289
  • 3
  • 33
  • 62

1 Answers1

2
Mapster.TypeAdapterConfig.GlobalSettings.Default.Config.CreateMapExpression(
  new Mapster.Models.TypeTuple(typeof(TSource), typeof(TTarget)), 
  Mapster.MapType.Projection);

Or if you are not using the global config, use your TypeAdapterConfig. Change the MapType to best match what you are trying to do.