C
C#2y ago
stevon8ter

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
Cannot find member Employeenumber of type Howest.API.Data.Struct.StaffNcrStruct. (Parameter 'name')
Cannot find member Employeenumber of type Howest.API.Data.Struct.StaffNcrStruct. (Parameter 'name')
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!
1 Reply
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View