Closed JoaoEdu93 closed 1 year ago
Hi, is it possible to set the values to null on the dto?
If you are asking about the properties that don't exist on the DTO but exist on the target object we are trying to map into, we cannot, since at the DTO level we don't know which they are. On the other hand, if you are refering to creating a new DTO with some of its values as null, yes we can.
Please see issue #69 for a solution to this. The use case is slightly different, but I believe you should be able to adapt the solution to your use case easily.
Hi.
I am working on a project where I need to map an object (can be a DTO or an ExpandoObject/Dictionary) that may have fewer properties than the target object. What currently happens is that properties that don't exist on the source become null at the target object and the intention would be that these properties should be ignored. I know there is the IgnoreNullValues method, but it is not enough, since we may actually want to set a property to null and not ignore it. I think we need a similar method, but one that ignores properties that don't exist at all on the source.
Best Regards.