none
.NET Core - Use Dependency Injection In non controller classes such as data access layer RRS feed

  • Question

  • My .NET Core application has 3 service/controller, domain, and data access layer ties. Each API call within the service/controller layer works as expected where the iMyResponse is always injected based on registration. The Domain/DAL initialize the 1st API call resulting in a singleton approach and not allow transient or scoped service lifetime. What am I missing?

    public MyDAL(IMyResponse iMyResponse) { iMyResponse is only called once so the service lifetime cannot be scoped or transient }

    services.AddTransient();
    • Moved by CoolDadTx Friday, October 25, 2019 1:37 PM ASP.NET related
    Friday, October 25, 2019 1:21 PM

All replies