Elsa 2.0: Consideration to use AutoMapper.Extensions.Microsoft.DependencyInjection, instead of own implementation
See original GitHub issueI have problems with my AutoMapper profiles. As soon as I use AddAutoMapper from Elsa Core, my profiles are not found. So I replaced it with an empty function on my end and call the AutoMapper functions in my main application.
I guess it is due to the AutoMapper implementation of Elsa Core. I use AutoMapper.Extensions.Microsoft.DependencyInjection.
I could replace the implementation of Elsa with AutoMapper.Extensions.Microsoft.DependencyInjection. But I wanted to inquire first if it is desired or if someone has another idea.
Issue Analytics
- State:
- Created 3 years ago
- Comments:8 (8 by maintainers)
Top Results From Across the Web
How to set up Automapper in ASP.NET Core
Adding AutoMapper.Extensions.Microsoft.DependencyInjection can change the dependency to a later version of AutoMapper and break Identity. Be ...
Read more >AutoMapper.Extensions.Microsoft.DependencyInjection ...
Scans assemblies and: adds profiles to mapping configuration; adds value resolvers, member value resolvers, type converters to the container. To use, with an ......
Read more >Getting Started with AutoMapper in ASP.NET Core
Extensions. Microsoft. DependencyInjection package, it will automatically install the AutoMapper package for us since it references it.
Read more >Dependency Injection
There is a NuGet package to be used with the default injection mechanism described here and used in this project. You define the...
Read more >AutoMapper Usage Guidelines
DO use the AutoMapper.Extensions.Microsoft.DependencyInjection package in ASP.NET Core with services.AddAutoMapper(assembly[]).
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

The easiest way is to use the extension method provided by Elsa (
AddAutoMapperProfile) to add your own profiles. Elsa already registers AutoMapper, so you will want to add your profiles to that instance.Alternatively, you can configure Elsa to use a different AutoMapper instance, but then you need to make sure to also register Elsa’s profiles.
Perhaps it would be better if we simply make AutoMapper a private dependency and wrap it in a custom mapper class that is them registered with DI. This way it won’t interfere with custom applications.
Fixed in 5b84a2e7a2e0cce33501fcd02f36f2411be68619