MapsterMapper / Mapster

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

Feature request: also force all source properties to be in destination #551

Open suntereo opened 1 year ago

suntereo commented 1 year ago

Thanks for a great and useful package!

We are using RequireDestinationMemberSource and it works well:

But we also have a need to check the other direction. Is there any plans or would it be possible to introduce a new property:

One scenario is where there's a one-way mapping from a stored proc DAO to DTO. A field is added to the table, picked up and added to the DAO by the EF Core PowerTools Reverse Engineering Tool, but not added to the DTO because the programmer forgot. We would love to see it throw an error here to alert us that the new property need to also be added to the DTO (destination) because it's in the source (DAO).

Another scenario is where a property is added to a request for a Save() web method. It was added to the SL but the programmer fails to add it to the DTO (and DAO). It might appear as though this new property is being saved from the front-end. But it isn't because it's just ignored. We would love to see an error thrown here to alert us that it's not being passed down.

p.s. The property names always confuse me. Wouldn't this be better: