문제

속성이있는 기사 수업이 있습니다

private IList<Tag> _tags;
public virtual IList<Tag> Tags
{
get{
if(_tags == null)
  _tags = TagService.GetTags(this);
return _tags;
}
}

태그에 대한 세트가 없기 때문에 ViewModel에서 맵핑 할 때 TAGS를 설정하지 않습니다. 어떤 아이디어?

도움이 되었습니까?

해결책

usedestinationValue 옵션을 사용해보십시오.

Formember (dest => dest.tags, opt => opt.usedestinationValue ());

트렁크의 최신 DLL에서 Automapper는 Readonly List-Type 멤버를 수령해야합니다.

다른 팁

다음을 사용하여 속성을 무시할 수 있습니다.

ForMember(dest => dest.Tags, opt => opt.Ignore());
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top