We are trying to map an object - Tridion Outbound Email Contact - which has its own property of a dictionary type with an internal constructor - ExtendedDetailCollection
This is an accurate display of an object in a Viewmodel
Mapper.CreateMap<Contact,ContactViewModel>()
.ForMember(x=>x.Name, m=>m.MapFrom(x=>x.ExtendedDetails["Name"].StringValue))
but the other way does not work
We tried:
Mapper.CreateMap<ContactViewModel,Contact>()
.ForMember(x=>x.ExtendedDetails["Name"].Value, m => m.MapFrom(x=>x.Name));
but this throws a runtime exception.
Edit: Exception message:
AutoMapper.AutoMapperConfigurationException: Custom configuration for members is supported only for individual top-level members by type.
We also tried various type converters and value converters, but none of them allows us to get the object that we are attached to, which we need to access to map the ExtendedDetails object to.
Mapper.CreateMap<ContactViewModel,Contact>()
.ForMember(x=>x.ExtendedDetails, m => ????);
?