AutoMapper / AutoMapper.Extensions.Microsoft.DependencyInjection

MIT License
258 stars 79 forks source link

Remove the configuration validation section #111

Closed lbargaoanu closed 5 years ago

lbargaoanu commented 5 years ago

Doesn't this just encourage people to call AssertConfigurationIsValid in production code?

jbogard commented 5 years ago

Yikes.

pr3sto commented 5 years ago

@lbargaoanu hey! it took some time for me to find the right way to call AssertConfigurationIsValid() and then I found out that this information was deleted from README file. I partially agree with the thought about production code but maybe just add something like this would be a better option instead of completely deleting this information:

public void Configure(IApplicationBuilder app, IHostingEnvironment env, IMapper autoMapper)
{
    if (env.IsDevelopment())
        autoMapper.ConfigurationProvider.AssertConfigurationIsValid();
}
lbargaoanu commented 5 years ago

But why not simply write that in a unit test?

pr3sto commented 5 years ago

@lbargaoanu yep, that makes sense. I was switching from static calls to di and was not sure how to make validation using di approach. This question from stackoverflow leads to a deleted section in README, so my point is that the deleted section was actually helpful in some way.

lbargaoanu commented 5 years ago

If you want to add the section back, beginning with the unit test thing, I guess that would be ok :)

lbargaoanu commented 5 years ago

See also http://docs.automapper.org/en/latest/Configuration-validation.html.

lock[bot] commented 5 years ago

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