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

Unity IoC and registering primitive types

Right then, I've run into a situation using Unity that I don't know how to solve/approach...Here's my problem. I'm developing a WPF application and I'm using MVVM (Prism Implimentation hence the Unity container). I have a ViewModel called…
1
vote
1 answer

Unity InjectionFactory factory function parameters meaning

In Unity 3, We have the following constructor for InjectionFactory public InjectionFactory(Func factoryFunc) Can someone tell me what is the meaning of the last three parameters Type, string, object ?
alcoforado
  • 516
  • 1
  • 4
  • 17
1
vote
3 answers

IOC Container Runtime Resolution

I'm trying to find an IOC container that will allow me to have mapping data for a field stored in a database and resolve the interface or object that needs resolved via a string value pulled from the database. Most of the examples I have seen are…
Firestrand
  • 1,305
  • 10
  • 19
1
vote
1 answer

How could you swap out a particular database implementation in python?

If I have a seperate class for my db calls, and I create another implementation of the db layer but say with a different data store. Is there a way for me to completly swap out the implementation without having to change allot of code? i.e. I am…
Blankman
  • 259,732
  • 324
  • 769
  • 1,199
1
vote
2 answers

SimpleServiceLocator: Why is automatic constructor injection not supported for singletons?

I've been experimenting with the SimpleServiceLocator, and I like it quite a bit, but there's one thing that I'm really frustrated by--you can't use automatic constructor injection for singletons. To make matters worse, you can't even use automatic…
devuxer
  • 41,681
  • 47
  • 180
  • 292
1
vote
1 answer

Spring Beans Configurations

if we have 1- a case scenario where we have class A configured as singleton and a child class B as a member within Class A configured as prototype. 2- Another case scenario, which is the opposite to the first one, where we have Class A defined as…
1
vote
1 answer

IoC - Initialize object state in the constructor

For every page request, I need to get some current user permissions data from the database and then use this information several times in the logic (which is made of several objects) I want to get data from the database once per request, and reuse…
user2418209
  • 109
  • 8
1
vote
3 answers

How to resolve ReflectionException Class orchestra.parser.xml does not exist

I am trying to create an xml file using Orchestral/parser https://github.com/orchestral/parser I correctly installed it and called it like this in my Controller: use Orchestra\Parser\Xml\Facade as XmlParser; ... class Product extends…
John Does Legacy
  • 1,441
  • 6
  • 23
  • 33
1
vote
1 answer

Intergrating (ian coopers) Brighter with StructureMap

I am jsut getting to grips with the basics of StructureMap (IoC) and am trying to intergrate the Demo of Brighter which can be found here https://iancooper.github.io/Paramore/QuickStart.html With Structuremap within an MVC project. The issue I am…
1
vote
2 answers

How do I use sturcturemap to pass two different implementations of a single interface into a constructor?

I have a constructor that take two interfaces, they are the same interface, but need to be different implementations: public class Foo { public Foo(IBar publicData, IBar privateData) { } } What I'd like to happen is that structuremap…
ilivewithian
  • 19,476
  • 19
  • 103
  • 165
1
vote
0 answers

Ninject exception at application startup

We encounter a problem while starting up an MVC 4 application. You can see the exception details in the picture. This exception is only caught by memory profiler. The service registration code is as…
Zafer
  • 2,180
  • 16
  • 28
1
vote
1 answer

How to create non keyed, non cached viewmodel using ViewModelLocator

I'm using MVVM Light in a simple WPF application. I understand that the ViewModelLocator class can be used to create cached view model objects, both with & without a key. However, I want to be able to create a view model that isn't cached or keyed.…
Tony Vitabile
  • 8,298
  • 15
  • 67
  • 123
1
vote
2 answers

IOC across visual studio projects?

I'm trying to retro-fit (bad idea I know, but better late than never) IOC and DI into an existing solution. The code base is made of up about 30 projects, each which have classes in them which have little or no visibility to the outside world.…
Ash
  • 5,057
  • 7
  • 35
  • 49
1
vote
1 answer

How to register a class instance including a parameter in SimpleIOC

I need to create an instance of a ViewModel with a specific parameter passed to the ViewModel when created. At the same time this ViewModel instance should be registered in SimpleIOC i thought this was the method for it: SimpleIoc.Register
lovetox
  • 75
  • 1
  • 7
1
vote
2 answers

Does IOC container makes object's when project is deployed?

How IOC container helps maintaing objects by creating once and injecting when required???
TaherT
  • 1,285
  • 2
  • 22
  • 41