문제

Automapper 1.0 RTW를 사용하고 있으며 몇 가지 커스텀 포맷터를 추가하고 있습니다.

    Mapper.AddFormatter<AlertTypeFormatter>(); 
    Mapper.AddFormatter<DateStringFormatter>();

목적지 유형은 문자열이며 Formatters는 개별적으로 작동합니다. 그러나 그것들을 합치면 첫 번째 포피터 만 부름을받습니다. 이 경우 "AlertTypeFormatter".

어떤 아이디어?

도움이 되었습니까?

해결책

결정된. 향후 참조를 위해 Mapper.addformatter는 실제로 Automap이 사용할 기본 포맷터를 설정합니다. 유형의 특정 포맷터를 설정하려면 사용해야합니다.

Mapper.ForSourceType<DateTime>().AddFormatter<DateStringFormatter>();

도 ...

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top