AutoMapper / AutoMapper.Extensions.Microsoft.DependencyInjection

MIT License
258 stars 79 forks source link

how to validate mapping #134

Closed ArjunVachhani closed 4 years ago

ArjunVachhani commented 4 years ago

I have created one profile for each destination type. I have configured dependency injection using services.AddAutoMapper(assembly1, assembly2 /*, ...*/); and it is working fine. I wanted to validate that all the properties in the destination type are mapped. we can do this by calling AssertConfigurationIsValid method. The below method is the sample to validate mapping.

var configuration = new MapperConfiguration(cfg =>
  cfg.CreateMap<Source, Destination>());

configuration.AssertConfigurationIsValid();

how to validate mapping when using services.AddAutoMapper(assembly1, assembly2 /*, ...*/);

lbargaoanu commented 4 years ago

I think this is better suited for StackOverflow.

github-actions[bot] commented 4 years ago

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.