tagged [dependency-injection]
Dependency injection: HttpClient or HttpClientFactory?
Dependency injection: HttpClient or HttpClientFactory? Everywhere I can see three main approaches to create clients (basic, named, typed) in DI, but I have found nowhere if to inject `IHttpClientFacto...
- Modified
- 11 Dec at 07:31
Dependency injection / IoC in Workflow Foundation 4
Dependency injection / IoC in Workflow Foundation 4 Is it possible to use DI in your workflow activities? and if yes, how? For example if you have an activity like how can i set `D
- Modified
- 12 Jan at 11:2
IServiceProvider in ASP.NET Core
IServiceProvider in ASP.NET Core I starting to learn changes in ASP.NET 5(vNext) and cannot find how to get IServiceProvider, for example in "Model"'s method I know, we configuring services a
- Modified
- 5 Feb at 21:27
Built-in dependency injection with conventions
Built-in dependency injection with conventions How to inject services without registering them? I mean in the past some DI frameworks automatically registered `Service` for `IService`. I'm in a situat...
- Modified
- 11 Feb at 20:23
Funq usage in ServiceStack
Funq usage in ServiceStack - `Container`- `Container.Resolve``Container`- - `new Container()``Funq.StaticContainer` Thanks to Mythz [for gist hint](https://gist.github.com/2844693), a) or b) or c). I ...
- Modified
- 24 Dec at 12:22
Override autofac registration with plugin
Override autofac registration with plugin I have an `IFoo` service implemented by `DefaultFoo`, and I've registered it as such in my autofac container. Now I would like to allow for an alternative imp...
- Modified
- 24 Jun at 17:42
How to inject constructor argument from config file with Unity
How to inject constructor argument from config file with Unity Imagine we have a class and app.config (or web.config) Is there way to register type MyClass in Unity container and point Unit
- Modified
- 15 Feb at 09:32
How to Use Ninject
How to Use Ninject I have been trying to use Ninject today and have a couple of questions. First of all do I need to use the Inject attribute on all constructors that I want to use injection for. This...
- Modified
- 15 Jan at 00:24
IOC for a Console Application?
IOC for a Console Application? Can anyone think of a good solution for getting IOC into a console application? At the moment we are just using a static class with the following method: I would like th...
- Modified
- 18 Jan at 14:2
Can someone explain Microsoft Unity?
Can someone explain Microsoft Unity? I've been reading the articles on MSDN about Unity (Dependency Injection, Inversion of Control), but I think I need it explained in simple terms (or simple example...
- Modified
- 3 Mar at 22:54
Injecting DI service on a extension method
Injecting DI service on a extension method I'm trying to get the `IStringLocalizer` service instance inside a extension method, is it possible? Any suggestions on how should I inject it? My goal here ...
- Modified
- 15 Feb at 08:9
Async provider in .NET Core DI
Async provider in .NET Core DI I'm just wondering if it's possible to have `async/await` during DI. Doing the following, the DI fails to resolve my service. where as the following works perfectly fine...
- Modified
- 22 Jun at 19:49
export generics in MEF
export generics in MEF I want to export a generic class to a generic interface via MEF. My objects are: But when I try to export `IService`, I get this error: > Attribute argument cannot use type para...
- Modified
- 5 Dec at 04:0
Spring: Why do we autowire the interface and not the implemented class?
Spring: Why do we autowire the interface and not the implemented class? ``` interface IA { public void someFunction(); } @Resource(name="b") class B implements IA { public void someFunction() { /...
- Modified
- 15 Oct at 16:24
.NET Core DI, ways of passing parameters to constructor
.NET Core DI, ways of passing parameters to constructor Having the following service constructor What are the choices of passing the parameters using .NET Core IOC mechanism ``` services.AddSingleton(...
- Modified
- 5 Sep at 14:14
Which .NET dependency injection framework do you use?
Which .NET dependency injection framework do you use? Currently there are quite a few DI/IoC-frameworks for .NET out there ([http://www.hanselman.com/blog/ListOfNETDependencyInjectionContainersIOC.asp...
- Modified
- 17 Feb at 08:37
How to use Autofac in a class library project?
How to use Autofac in a class library project? I have the following implementation: This service is in a separate project than that of my web project. Where and how would I specify the dependency inje...
- Modified
- 1 Feb at 12:59
Injecting arrays with Unity
Injecting arrays with Unity My goal is to constructor inject an array of objects implementing an interface. The following is the way I currently have it. ``` Container .RegisterInstance(ParseCompa...
- Modified
- 16 Apr at 10:10
Constructor injection with Quartz.NET and Simple Injector
Constructor injection with Quartz.NET and Simple Injector Currently I am writing a service using Quartz.NET to schedule the running of it. I was wondering if anyone has any experience of using constru...
- Modified
- 29 Jan at 13:21
Use dependency injection in static class
Use dependency injection in static class I need to use Dependency Injection in a static class. the method in the static class needs the value of an injected dependency. The following code sample demon...
- Modified
- 29 May at 12:22
Explain why constructor inject is better than other options
Explain why constructor inject is better than other options In a Pro Spring 3 Book, Chapter 4 - Introduction IOC and DI in Spring - Page 59, In "Setter Injection vs. Constructor Injection" section, a ...
- Modified
- 6 Jul at 23:38
Dependency injection, inject with parameters
Dependency injection, inject with parameters I'm using vNext implementation of DI. How to pass parameters to constructor? For example, i have class: ``` public class RedisCacheProvider : ICacheProvide...
- Modified
- 4 Jul at 11:6
When to use TryAddSingleton or AddSingleton?
When to use TryAddSingleton or AddSingleton? I've noticed in some .NET Core examples there are calls to `TryAddSingleton`, and in some `AddSingleton` when registering services. Decompiler shows that T...
- Modified
- 3 May at 04:51
The requested service has not been registered ! AutoFac Dependency Injection
The requested service has not been registered ! AutoFac Dependency Injection I am simply trying to use AutoFac to resolve dependencies but it throws exception such as > ``` class Program { static vo...
- Modified
- 16 Mar at 12:14
What is a JavaBean exactly?
What is a JavaBean exactly? I understood, I think, that a "Bean" is a Java-class with properties and getters/setters. As much as I understand, it is the equivalent of a C `struct`. Is that true? Also,...
- Modified
- 12 Oct at 12:25