Replies: 1 comment 3 replies
-
This: _mapper.Map(mutationCar, existingCar); Is reverse mapping. AutoMapper is almost exclusively designed for mapping from complex models to simple DTOs. Mapping back into the more complex model, where you're providing the existing object, the EF/data/domain model IS reverse mapping. I don't mind supporting the simplest of cases, but absolutely do not want to support anything remotely complicated. What you're asking is beyond the level of complication that I would ever want to support, or would ever want to use or recommend AutoMapper for. Even if it doesn't seem seem that much for you, I don't like the idea of reverse mapping into more complex data models and don't want to make it easy to do so. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
This is a follow up of #4333
I don't want to pry, but seeing as the previous issue is locked, this is the only way to react to the discussion. If you don't want to do anything with this, this fine and we will keep doing the workaround I've just implemented, but it is not ideal to use.
I was triggered by the last reaction of @jbogard , stating he doesn't want to add features to reverse mapping. I just want to make sure that you guys are understanding the issue correctly, because I don't think it has anything to do with reverse mapping. I am not reverse mapping, I am mapping, but a want to avoid setting the target member when the source member is null.
We need this workaround because we have no way to access the actual value the of the source of the mapping resulted in, when mapping from a nullable to a non nullable. However, this only works if the source member has the same name as the target member, and no custom mapping is used. If we would have some kind of method to actually get the original value that was the result of the source of the map, this would be much easier, and would support all scenario's, also when we are using a custom mapping expression for a target member.
Like I said, if you don't want to add any functionality for this, no harm done. But I just want to make sure you reject this idea for the correct reasons and I was unable to respond to the previous discussion anymore
Beta Was this translation helpful? Give feedback.
All reactions