About 414,000 results
Open links in new tab
  1. c# - AddTransient, AddScoped and AddSingleton Services …

    Jul 1, 2016 · I want to implement dependency injection (DI) in ASP.NET Core. So after adding this code to ConfigureServices method, both ways work. What is the difference between the …

  2. Dependency Injection with Multiple Constructors - Stack Overflow

    Oct 4, 2015 · I've ended up with the following workaround until they fix/improve this. First, declare only one constructor in your controller (passing your required configuration settings only), …

  3. Correctly Injecting Serilog into .net core classes as Microsoft ...

    Jan 10, 2020 · This is for a WPF/Console application .Net 6 ILogger Update - As stated by Microsoft Starting with .NET 6, logging services no longer register the ILogger type. When …

  4. c# - Resolving instances with ASP.NET Core DI from within ...

    How do I manually resolve a type using the ASP.NET Core MVC built-in dependency injection framework? Setting up the container is easy enough: public void …

  5. How to get an instance of IServiceProvider in .NET Core?

    object GetService(Type serviceType); It's used to create instances of types registered in .NET Core native DI container. An instance of IServiceProvider itself can be obtained by calling a …

  6. c# - Async IServiceProvider in .NET Core DI - Stack Overflow

    c# dependency-injection async-await asp.net-core-mvc asp.net-core-webapi edited Dec 14, 2023 at 8:51 Steven 174k 27 355 453

  7. AutoMapper does not work in .NET Core 8 when I use dependency …

    Feb 13, 2024 · AutoMapper does not work in .NET Core 8 when I use dependency injection Asked 1 year, 10 months ago Modified 1 month ago Viewed 26k times

  8. Access to configuration without dependency injection

    Jan 20, 2017 · Since this is strictly a utility class, I don't want have to inject this class into every other class that needs to use a method or two from the utility. Any ideas on how to access the …

  9. .NET Core DI, ways of passing parameters to constructor

    Dec 21, 2018 · The recommended way to achieve this is to use the Options pattern - note that this applies to any .NET Core/5 application, not just ASP.NET Core. But there are use cases …

  10. Dependency Injection in .NET Core 3.0 for WPF - Stack Overflow

    Jan 20, 2023 · I’m quite familiar with ASP.NET Core and the support for dependency injection out of the box. Controllers can require dependencies by adding a parameter in their constructor. …