MapsterMapper / Mapster

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

How can I obtain the changed field values after mapping two entities? #692

Open wapco opened 6 months ago

wapco commented 6 months ago

Hi, I would like to know which fields have been changed after mapping entities using [Mapster], in order to facilitate the creation of audit logs in the future. Does Mapster currently support this feature or will it support it in the future?

Eq:


var car = new Car
{
    Name = "my car",
    NumberOfSeats = 5,
    Color = CarColor.Blue,
    Manufacturer = new Manufacturer(1, "best manufacturer"),
};

var carDto = new CarDto
{
    Name = "your car",
    NumberOfSeats = 6,
    Color = CarColor.Black,
    Manufacturer = new Manufacturer(1, "best manufacturer"),
};`

audit log like this: 
Name: my car -> your car,
NumberOfSeats: 5 -> 6
Color: CarColor.Blue -> CarColor.Black