Closed sanioooook closed 4 years ago
https://jimmybogard.com/automapper-usage-guidelines/
X DO NOT inject dependencies into profiles
Profiles are static configuration, and injecting dependencies into them can cause unknown behavior at runtime. If you need to use a dependency, resolve it as part of your mapping operation. You can also have your extension classes (resolvers, type converters, etc.) take dependencies directly.
It seems this question is repeated in part, but I did not understand the answer, so I ask again. My problem is that I need my own service for mapping, which I thought I would get in the constructor using DI, but when I try mapping, I get an error![image](https://user-images.githubusercontent.com/33792718/90424686-31646c00-e0c7-11ea-9b11-18303a279659.png)
AnswerMappingProfile.cs:
Startup.cs:
How can I solve this problem?