AutoMapper / AutoMapper.Extensions.Microsoft.DependencyInjection

MIT License
258 stars 79 forks source link

How can I call CompileMappings on MapperConfiguration when using AddAutomapper #144

Closed DemetriouJohn closed 4 years ago

DemetriouJohn commented 4 years ago

Using AddAutomapper one needs only to provide assembly location of profiles. But since I have no control and no access over MapperConfiguration, how can one call MapperCongiguration.CompileMappings() ?

lbargaoanu commented 4 years ago

You should inject IConfigurationProvider where you need it.

jbogard commented 4 years ago

One possibility is using a hosted service to run this on startup and inject the mapper configuration into that. I use that frequently for startup tasks.

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.