I have two similar objects that I am mapping to each other using AutoMapper. I create the map by doing the following:
CreateMap<Object1, Object2>()
.ForMember(d => d.Name, o => o.MapFrom(s => s.Name))
.ForMember(d => d.Description, o => o.MapFrom(s => s.Description))
Now Object1 has a property Object3[] listOfObject3 this Object3 has an Id property which I want to map to my Object2 property with string[] listOfObject3Ids
I tried the following but that doesn't work:
CreateMap<Object1, Object2>()
.ForMember(d => d.Name, o => o.MapFrom(s => s.Name))
.ForMember(d => d.Description, o => o.MapFrom(s => s.Description))
.ForMember(d => d.listOfObject3.Id, o => o.MapFrom(s => new [] {s.Id})
How do I solve this?