c# - Unable to Map Registration to RegistrationDTO -
i tried mapping registrationdto registration using following code worked fine.
mapper.createmap<registrationdto, registration>() .formember(dest => dest.address, o => o.mapfrom(s => s.address != null ? s.address : s.address)) .formember(dest => dest.businessentityaddress, src => src.mapfrom(s => s.businessentityaddress != null ? s.businessentityaddress : s.businessentityaddress)); mapper.createmap<addressdto, address>();
and mapper code is,
registration userdetails = mapper.map<registrationdto, registration>(user);
now inorder convert registrationdto registration used below code
mapper.createmap<registration, registrationdto>() .formember(dest => dest.address, o => o.mapfrom(s => s.address != null ? s.address : s.address)) .formember(dest => dest.businessentityaddress, src => src.mapfrom(s => s.businessentityaddress != null ? s.businessentityaddress : s.businessentityaddress)); mapper.createmap<address, addressdto>();
and respective mapping code is
registrationdto userregdto = mapper.map<registration,registrationdto>(userreg);
now when run code, there's exception says "automappermapping excpetion caught." near,
registrationdto userregdto = mapper.map<registration,registrationdto>(userreg);
is there missing map? please me out this?
Comments
Post a Comment