MapsterMapper / Mapster

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

Add Support for Conditional Access Expressions #708

Open j0nimost opened 1 month ago

j0nimost commented 1 month ago

Currently, we cannot use conditional access expressions while declaring mappings. For example;

TypeAdapterConfig<ItemA, ItemB>.NewConfig()
    .Map(dest => dest.Name, src => src.ItemAChild?.Name);

The above example would fail with an error, however, conditional access is very common when mapping values. This is a needed feature.