MapsterMapper / Mapster

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

How Map From A Method Like Update ? #687

Open AmBplus opened 6 months ago

AmBplus commented 6 months ago

"I’m working with a complex model. When I need to update an instance of this model, I want to avoid changing certain fields like createDate. Currently, I can't achieve this by using a constructor with global settings to use the constructor. However, I’d like to specify a custom method for mapping instead of relying solely on the constructor. How can I achieve this using Mapster?

For example, I’d like to do something like:

TypeAdapterConfig.GlobalSettings.Default.MapToConstructor(true).UseMethod("Update"); i mean do it automate Where the method Update would handle the mapping. Is there a way to achieve this with Mapster?"