Question
I have Article class with property
private IList<Tag> _tags;
public virtual IList<Tag> Tags
{
get{
if(_tags == null)
_tags = TagService.GetTags(this);
return _tags;
}
}
Since there is no SET for Tags automapper will not set tags when mapping from viewmodel to view. Any ideas?
Solution
Try using the UseDestinationValue option:
ForMember(dest => dest.Tags, opt => opt.UseDestinationValue());
In the latest DLL on the trunk, AutoMapper should pick up readonly list-type members.
OTHER TIPS
You can Ignore then property using:
ForMember(dest => dest.Tags, opt => opt.Ignore());
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow