Inversion of Control

learn more… | top users | synonyms

1
vote
0answers
135 views

Dependency injection, but not into a controller [migrated]

I recently began experimenting with DI. I am using Unity Ioc to inject an EmailService from by Business Logic Layer into EmailServiceWrapper in the presentation layer which is then instantiated, my ...
2
votes
1answer
68 views

Transient life time and constructor injection

I'm working on a little light weight Dependency resolver found here https://github.com/AndersMalmgren/DuoCode.SimpleInjector Currently if you do var instance = container.Get<Foo>(); You ...
1
vote
1answer
135 views

Does merely parameterizing a dependency meet the requirements for Inversion of Control?

When I find a concrete dependency inside an extension method, I have been attempting to remove the (concrete) dependency by parameterising it like so // original implementation public static ...
3
votes
2answers
159 views

IoC invalidation

I have a bunch of services that get registered as singletons by my IoC container on startup, all of these services have a constructor which takes in a connection string which is used by the underlying ...
2
votes
1answer
103 views

Applying initialization-on-demand holder idiom at variable level rather than class

I was looking for the idiomatic way to implement thread-safe lazy initialization for a configuration collection retrieved from the DB inside a Spring bean. I decided to adapt the ...
2
votes
1answer
214 views

IoC, Unity and passing parameters (or a way to avoid doing so)

While the concept of IoC isn't foreign to me, I'm new to Unity and I'm having trouble connecting the metaphorical dots, so to speak. In our project we have a class library for logic, then several ...
0
votes
0answers
127 views

Correct Command Management with IoC and MVVM

I have developed an MVVM framework that can be inherited by a project and used to back a new application. This application can then have plugins (like a CodeEditor for example) which automatically are ...
14
votes
3answers
861 views

I get dependency injection, but can someone help me understand the need for an IoC container?

I apologize if this seems like yet another repeat of the question, but every time I find an article regarding the topic, it mostly just talks about what DI is. So, I get DI, but I'm trying to ...
36
votes
5answers
4k views

IOC Containers break OOP Principles

What is the purpose of IOC Containers? The combined reasons for it can be simplified to the following: When using OOP/SOLID Development principles, Dependency Injection gets messy. Either you have ...
1
vote
2answers
186 views

Why do IoC containers provide public Resolve method(s)?

In my opinion it just inverses the inversion and could make new users (including myself) make incorrect assumptions about using IoC containers. It can be used for the Service Locator (anti-)pattern ...
1
vote
1answer
80 views

Creating an object that is ready to be used & unset properties - with IoC

I have a question regarding the specifics of object creation and the usage of properties. A best practice is to put all the properties into a state such that the object is useful when its created. ...
2
votes
1answer
292 views

How can I identify a namespace without using a string literal?

My team has a lot of IOC conventions that look something like... if (type.Namespace == "My.Fun.Namespace") { // do stuff } Of course, maintaining this kind of thing becomes brutal after awhile, ...
9
votes
2answers
459 views

Compile-time IOC

Has anyone started a project to do IOC at compile time (possibly using Roslyn or Linq MethodInfo emit)? My experience with IOC containers has thus far been great, baring a few small issues Many IOC ...
0
votes
1answer
97 views

How to apply IoC (or something similar) to a constant?

I have the following class with the following members: public class RegistrationPresenter : EPiPresenter<IRegistrationView, LoginPage>, IDisposable { private readonly static string[] ...
10
votes
2answers
554 views

How do you manage config with dependency injection?

I am a big fan of DI/IOC. It is great for handling/abstracting away hard dependencies, and makes life a little easier. However I have a small gripe with it, which I am not sure how to solve. The ...
2
votes
3answers
871 views

Should IoC container be part of portable library?

I am seeing the benefits of Portable Class Libraries for centralizing Models and ViewModels to a single code-base. Where should dependency injection management (IoC container) take place, though? My ...
4
votes
2answers
249 views

Is Convention Over Configuration “Knowledge in the World” or “Knowledge In Your Head”?

In Don Norman's seminal work "The Design of Everyday Things", the author coined the phrases and explains the difference between "Knowledge in the World" and "Knowledge In Your Head"; an example of ...
1
vote
1answer
207 views

it is a good approach to implement dependency injection in a desktop app?

Well, the thing is that I am just about to create a Desktop App (with .NET windows forms) And now I just wonder if it would be really a wise choise to use any IoC (StructureMap,Ninject,Spring .Net), ...
50
votes
5answers
8k views

Why is Inversion of Control named that way?

The words invert or control are not used at all to define Inversion of Control in the definitions that I've seen. Definitions Wikipedia inversion of control (IoC) is a programming technique, ...
3
votes
5answers
7k views

Dependency Injection Confusion

I think I have a decent grasp of what Dependency Inversion principle (DIP) is, my confusion is more around dependency injection. My understanding is the whole point of DI is to decouple parts of an ...
1
vote
3answers
234 views

Shall we always use IoC in our designs?

I was studying Mediator Pattern and I noticed that to use this pattern you should register the Colleagues into Mediator from the Colleague concrete classes. for that we have to make an instance of ...
2
votes
1answer
265 views

Is it a bad design to specify default bindings when using Inversion of Control (IOC) containers and dependency injection (DI)?

I'm using Ninject, but this is not a Ninject-specific question. I'm wondering if the advanced and flexible capabilities of the IoC container are giving me enough rope to hang myself with a bad ...
10
votes
1answer
4k views

Dependency Injection/IoC container practices when writing frameworks

I've used various IoC containers (Castle.Windsor, Autofac, MEF, etc) for .Net in a number of projects. I have found they tend to be frequently abused and encourage a number of bad practices. Are ...
13
votes
5answers
1k views

Does following TDD inevitably lead to DI?

I learned to do Test Driven Development (TDD), Dependency Injection (DI) and Inversion of Control (IoC) all at the same time. When I write code using TDD I always end up using DI in my class's ...
2
votes
2answers
502 views

DI/IoC in Java for a .NET'er used to Castle.Windsor

Is there a Java DI container that works in a similar way to the most excellent Castle.Windsor container on the .NET side? The Java containers I've had a look at all seem to rely on annotations ...
4
votes
1answer
3k views

Is IoC feasible in winforms?

I'm coming back into the winform world after being in the web world for a while. Is it common or otherwise feasible for developers to use IoC in winform? My concern is mainly with performance. I ...