MapsterMapper / Mapster

A fast, fun and stimulating object to object Mapper
MIT License
4.3k stars 328 forks source link

Expression mapping #517

Closed ryco72 closed 1 year ago

ryco72 commented 1 year ago

Can Mapster map expressions? E.g., I'd like to use Mapster to do this:

entityFilterExpression = _mapper.MapExpression<Expression<Func<TEntity, bool>>(modelFilterExpression)

where modelFilterExpression is of type Expression<Func<TModel, bool>>

This is feasible with the library AutoMapper.Extensions.ExpressionMapping, but till now I didn't find a way to do the same with Mapster

andrerav commented 1 year ago

One of Mapsters major advantages compared to Automapper is code generation, and expression mapping would be complicated to implement (if even possible) given the way the code generation works now. If the current feature set is not enough to cover your use cases then I think you're out of luck, unfortunately.