AutoMapper - Ignore 'SourceMember' for specific type
Hey folks
During the development of our API, I stumbled upon a roadblock I wish to overcome.
We have 2 types of 'Staff', but we wish to use only 1 object to return them (with the non-used properties as null)
I'm trying to AutoMap to our return object from 2 different structs (see image)
StaffNcrStruct does not have a property 'Employeenumber' - Throwing an Exception from AutoMapper
Is there a way to disable the SourceMember attribute for this specific struct?
Or do I have to abandon the attribute and define the mappings as in image 2?
(Ofcourse actually mapping the members for each type)
Thanks in advance!
![](https://utfs.io/f/c97ddb02-2abe-4550-bdc3-8d73b1c7fce8-4pl4mu.png)
![](https://utfs.io/f/c6750f6f-e278-446b-be76-2d9d5b99c3aa-4pl4mu.png)
1 Reply
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View