Questions tagged [ioc-container]

In object oriented languages, an inversion of control container (ioc-container) can be used for configuring and managing objects in an application.

In object oriented languages, an inversion of control container (ioc-container) can be used for configuring and managing objects in an application. The container is responsible for managing object lifecycles (creation, initialization, destruction) and configures objects by wiring them together.

Objects managed by the container obtain references to other objects (their dependencies):

  • by explicitly asking the container, using dependency lookup methods on the container
  • automatically, because the container injects the dependencies using one or more dependency injection techniques

Frameworks that provide an ioc-container support one of these methods and often both.

The following frameworks are discussed here at Stackoverflow

For .NET:

For Java:

2163 questions
1
vote
1 answer

Microsoft Unity IoC does not work and ASP.NET mvc4 application. Why?

I'm trying to set up Unity IoC container to ASP.NET mvc4 application. I created empty project and using package management console installed next products Install-Package Unity Install-Package Unity.Mvc4 Everything finished successfully. But…
Vitalii
  • 10,091
  • 18
  • 83
  • 151
1
vote
1 answer

Where to put libraries for the IoC Container to work in Laravel?

The IoC container is kind of a complex subject for me, and coming from a Codeigniter background (where you just could copy and paste a library and it worked by including it with include_once()), it's a difficult concept to wrap my head around. I'm…
AeroCross
  • 3,969
  • 3
  • 23
  • 30
1
vote
1 answer

instantiate the implementation class of Depenency injection using unity framework in mvc 3

I have a login controller which accept the instance of user and in login method it call the Validate user correctly but the problem arises in UserManager if i include a constructor in a similar manner public LoginController(IUser user) { …
1
vote
1 answer

Reflecting the Target of Injection

A very common logging goal I find in various projects, is that any class/object which creates a log entry will record its own class/object name into that entry. If the log entry is for an exception and stack-trace, that information is included for…
Brent Arias
  • 29,277
  • 40
  • 133
  • 234
1
vote
1 answer

How to define Spring bean with unique id (not within the file)?

I've a lot of Spring xml files and I wish that each bean must have unique id (or name doesn't matter for me) for whole Spring scope. Cal I tell Spring to throw and exception in case of non uniqueness of beans id/names?
FoxyBOA
  • 5,788
  • 8
  • 48
  • 82
1
vote
1 answer

How do I create a well-structured ASP.NET MVC multi-site codebase?

I'm working on a project that has the ultimate vaguely-defined requirement: "Site should be 'skinnable' for other clients." As we all know, there are almost always UI, logic and model changes that have to be made. I've explained that work will be…
Bret Walker
  • 1,796
  • 5
  • 20
  • 41
1
vote
2 answers

Should I upgrade to Castle Windsor v2?

We are evaluating to upgrade Castle Windsor Container to Version 2, which was released in May this year. By this time I would expect the community to have made some experiences about the new release... My main concerns are: Is it worth the effort…
JacobE
  • 8,021
  • 7
  • 40
  • 48
1
vote
1 answer

What is the best inversion of control container to use when developing on ASP .NET MVC 3 with EF?

I am developing an enterprise web application and have a little knowledge for inversion of control containers available today. I have an average knowledge for ASP .NET MVC 3. Among the choices I have are Castle.Windsor and Unity. Both has inversion…
1
vote
0 answers

Register one Service with multiple names for every Component of certain service by convention

I use Castle-Windsor 3.1 and C# 4.0. I register some components (views) by convention, like this Classes.FromThisAssembly() .BasedOn(typeof(ITabPageView<>)) …
Andreas H.
  • 766
  • 9
  • 17
1
vote
1 answer

Castle Windsor Dependency Injection with Multiple Concrete Implementations

Is there a method for Castle Windsor to inject multiple concrete implementations of a single interface into a constructor? I want to do something like this: class Some { public Some(IService[] services) { services.Each(s =>…
Daniel A. White
  • 187,200
  • 47
  • 362
  • 445
1
vote
2 answers

Does Autofac have a best practice for *optional* Xml configuration?

Background: I wanted to distribute a library to some other developers (something along the lines of an SDK or toolkit abstracting some internal web services). I'm using Autofac in order to inject different versions of the underlying services,…
joshua.ewer
  • 3,944
  • 3
  • 25
  • 35
1
vote
3 answers

what is the Difference Between singleton and prototype scopes in Spring 2.5

i read tutorial about spring bean scopes in that they mentioned if bean scope is prototype Spring container will create new object every context.getBean("id") statement. and if we specify scope is singleton it will create only one object even though…
Clarence
  • 896
  • 1
  • 9
  • 27
1
vote
0 answers

Is there any equivalent in spring like buildup in unity

"BuildUp" means not to create an object, but inject dependencies to an existing object according to annotations such as "Required". Expecting it will find proper beans for those dependencies automatically.
1
vote
1 answer

Windsor AddComponentInstance problem

I have successfully setup castle windsor using an xml configuration file and everything works fine. The only problem is that on a method I need Windsor to pass an existing instance to the constructor so I…
George Statis
  • 548
  • 3
  • 12
1
vote
1 answer

How to conditionally supply constructor arguments with StructureMap?

I would like to conditionally supply a constructor argument to StructureMap based on the parent type. I am trying to achieve this with the code below. The concrete type ProcessorSettings is a constructor argument to both TypeOne and TypeTwo.…
nixon
  • 1,952
  • 5
  • 21
  • 41
1 2 3
99
100