문제

There are two types of exceptions in Automapper and I can´t find information anywhere on how to use them.

The exceptions are AutoMapperMappingException and AutoMapperConfigurationException

Does anybody know the difference of these two and how I should set up try/catch for them?

도움이 되었습니까?

해결책

Check the source code.

AutoMapperConfigurationException is used when the mapping profiles are loaded up by AutoMapper. Its thrown my Automapper when performing a configuration checks.

    [Test]
    public void Mapper_AssertConfigurationIsValid_Expect_No_Exceptions()
    {
        AutoMapper.Mapper.AssertConfigurationIsValid();
    }

AutoMapperMappingException is used during "runtime"...that is when the actual mapping code is run to turn your source dto to your destination dto.

HTH.

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