question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Elsa 2.0: Consideration to use AutoMapper.Extensions.Microsoft.DependencyInjection, instead of own implementation

See original GitHub issue

I 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:closed
  • Created 3 years ago
  • Comments:8 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
sfmskywalkercommented, Dec 23, 2020

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.

0reactions
sfmskywalkercommented, Dec 24, 2020

Fixed in 5b84a2e7a2e0cce33501fcd02f36f2411be68619

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found