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

Simple Injector tracing times

is there a way I can keep track of how much time is taken to resolve an instance via Simple Injector and Constructor's IoC? I mean something at trace level Thanks
advapi
  • 3,661
  • 4
  • 38
  • 73
1
vote
1 answer

custom pipeline processors and IOC in sitecore mvc

Does sitecore mvc supports custom pipelines as in asp.net web forms? I have a class which implements RenderLayoutProcessor and override Process method. This class name is added as custom processor in the pipeline by updating the web config section…
1
vote
1 answer

Are "Dependency Injection Container" and "Inversion of Control Container" one and the same thing?

In many articles i read about Dependency Injection Container, and many others talk about IoC Container. And while there must be some places that mention both, i have not come across one yet. So the question is: What is the relationship between these…
1
vote
2 answers

Laravel 5 Resolving dependencies in ServiceProvider

I have a class which acts like a storage (add/get item). I try to bind it as a singleton in one service provider, and resolve it in another's boot method. The code is changed for simplicity. app/Providers/BindingProvider.php
fakemeta
  • 938
  • 1
  • 8
  • 21
1
vote
1 answer

IoC: advantages of using a child container in web based app

I'm interested in knowing if there are any advantages to creating a child container for each request in a web based application? The tech stack I'm using includes StructureMap & ASP.NET MVC, which is not particularly relevant but included as…
AwkwardCoder
  • 24,893
  • 27
  • 82
  • 152
1
vote
1 answer

Lightinject with Web API - How can I get the HttpRequestMessage?

How can I get the current HttpRequestMessage when using Lightinject with Web API? In Simple Injector, for example, I have the following extension method on the container: var msg = container.GetCurrentHttpRequestMessage() But I couldn't find a…
Yaron Levi
  • 12,535
  • 16
  • 69
  • 118
1
vote
2 answers

WinRT Caliburn Micro SimpleContainer: registering a decorator in a container

How can i register a decorator using caliburn micro for below scenario in WinRT universal app: I have Caliburn micro container which is register types: _container.RegisterInstance(IService, "", Service); I have created following IService…
Balraj Singh
  • 3,381
  • 6
  • 47
  • 82
1
vote
1 answer

hosting simple python scripts in a container to handle concurrency, configuration, caching, etc

My first real-world Python project is to write a simple framework (or re-use/adapt an existing one) which can wrap small python scripts (which are used to gather custom data for a monitoring tool) with a "container" to handle boilerplate tasks…
Justin Grant
  • 44,807
  • 15
  • 124
  • 208
1
vote
1 answer

How to register in unity passing a params array of two distinct types?

I'm new to Unity. So hopefully I'm asking the right thing because I'm still trying to grasp the proper way to implement DI and IoC. I'm trying to create a MVC5 site that initializes controllers with a specific constructor. Here is what I am trying…
1
vote
1 answer

Using Laravel container for repositories

I'm working with repositories lately and I'm trying to solve some default actions or needed behaviour in the main repository which is named AbstractRepository. The AbstractRepository looks like this: class AbstractRepository { protected $session; …
guidsen
  • 2,333
  • 6
  • 34
  • 55
1
vote
1 answer

Can StructureMap be configured so that one can use different .config settings based on whether the project was built in debug or release mode?

I know that in StructureMap I can read from my *.config files (or files referenced by them), when I want to pass specific arguments to an object's constructor. ForRequestedType() …
Mark Rogers
  • 96,497
  • 18
  • 85
  • 138
1
vote
1 answer

Castle, sharing a transient component between a decorator and a decorated component

Consider the following example: public interface ITask { void Execute(); } public class LoggingTaskRunner : ITask { private readonly ITask _taskToDecorate; private readonly MessageBuffer _messageBuffer; public…
Marius
  • 9,208
  • 8
  • 50
  • 73
1
vote
1 answer

Is possible constructor injection using deserialization?

On the following code: var serializer = new XmlSerializer(typeof(MyPOCOType)); using (var reader = XmlReader.Create(fileName)) { var pocoInstance = (MyPOCOType)serializer.Deserialize(reader); } I am using ninject. The MyPOCOType has an…
1
vote
1 answer

MongoCollectionFinder : ICollectionFinder> how to register this component using Windsor Castle?

public class MongoCollectionFinder : ICollectionFinder> { private readonly IDatabaseContext _databaseContext; public MongoCollectionFinder(IDatabaseContext databaseContext) { …
1
vote
0 answers

Why there is no Application Context in spring mvc application?

I was looking at spring mvc source example (pet clinic) and was a bit confused. How I'm suppose to instantiate beans (getBean method) without having an application context. How spring does autowiring without it.
flgdev
  • 467
  • 1
  • 6
  • 17