문제

Is there any possibility to add logging (like nlog) to automapper map method ?

I will really want to have logged info about all mappings between objects.

Thanks

도움이 되었습니까?

해결책

You can use the BeforeMap event:

Mapper.CreateMap<SourceType, DestinationType>().BeforeMap((src, dst) =>
{
     SomeStaticLogger.DebugFormat("Mapping stuff from {0} to {1}", src, dst);
});
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top