How to check configuration using automapper instance API

I know that with the autoapper static API I can do this:

Mapper.Initialize(cfg => 
  cfg.CreateMap<Source, Destination>());

Mapper.Configuration.AssertConfigurationIsValid();

      

but now I have switched to the instance API:

var config = new MapperConfiguration(cfg => {
    cfg.AddProfile<AppProfile>();
    cfg.CreateMap<Source, Dest>();
});

var mapper = config.CreateMapper();

      

How / where can I check if the configuration is valid using the instance API?

+3


source to share


1 answer


You can also check using:



mapper.ConfigurationProvider.AssertConfigurationIsValid();

      

+2


source







All Articles