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

Autofac: injecting in injected object (resolve difficult dependencies)

I need to inject object B and C to A where object C is used by B (all objects are created in Autofac) If there will be no needs for B to use C (object C is used for storing parameters) and I could use hardcoded values I could write something like…
Anton Putov
  • 1,951
  • 8
  • 34
  • 62
1
vote
1 answer

can StructureMap auto-register Handler for IHandler?

I posted an issue on SM repo. My question is similar to this one, but I'd like to localize a problem. Let's say I have generic interface IPrinter and its generic implementation Printer. I'd like StructureMap to resolve the concrete closed type…
1
vote
1 answer

Wcf with SimpleInjector throws "WCF scopes can not be nested"

The service layer is seperated into command and query side and each side has their handlers. The following configuration is used // EF context _container.RegisterPerWcfOperation
1
vote
1 answer

pushing a ViewController from a Container View changes its view frame to original size

I've created something similar to the picture I've added. I've connected using Ctrl+Drag the UIButton to the Child View 2 ViewController and selected push segue.(the picture shows custom segue, ignore it please) My problem is that when I tap the…
Segev
  • 19,035
  • 12
  • 80
  • 152
1
vote
1 answer

Spring.Net IoC: alternative to using configuration metadata XML

I'm trying to get a grasp of using spring.net ioc to suit my purpose. What options to using xml configuration (metadata file) are available in spring.net ioc. i.e. i don't want to use the following:
fash1
  • 11
  • 1
1
vote
1 answer

NServicebus Message Handler Lifecycle in IOC StructureMap

What is the required IOC instance lifecycle I need to use in conjuction with a NServiceBus message handler if I want an instance per message handled. PerRequest won't work, since given the numerous constructor dependenices and dependency graph I…
user53791
1
vote
2 answers

Manage multiple ravendb document stores through castle windsor in an MVC app?

I twist myself around a workable solution to use several databases in RavenDB for an ASP.Net MVC app using Castle Windsor for the wiring. This is the current installer public class RavenInstaller : IWindsorInstaller { public void…
Max
  • 3,280
  • 2
  • 26
  • 30
1
vote
2 answers

Should I use Castle Windsor because NHibernate is using it, and I'm already using NHibernate?

I've just finished converting a large amount of legacy code to use NHibernate. The next thing I want to do is introduce an IOC container for hooking up the data access layer repositories and other such things. There are a variety of options out…
cbp
  • 25,252
  • 29
  • 125
  • 205
1
vote
0 answers

Castle Windsor - slow debugging

I have recently started working on an ASP.NET MVC project that uses Castle Windsor. The problem is, each time I try to debug the application, this part of code takes a couple of minutes to execute: protected override IController…
1
vote
1 answer

Child containers in MvvmCross IoC

I have a WPF MVVM application that I'd like to refactor to use MvvmCross to support a WPF and Mono for Android implementations. Currently we are using Unity 3.0 for dependency injection and rely on its support for container hierarchies (one main…
HolySamosa
  • 9,011
  • 14
  • 69
  • 102
1
vote
2 answers

Use Ninject.InSingletonScope() for all classes in defined namespace

I have a set of repositories in a class lib that are required to be singletons. They share library with other classes as well - classes created as singletons. Is it possible to configure Ninject to automatically use InSingletonScope() for all…
ForestC
  • 213
  • 1
  • 12
1
vote
1 answer

How can I use Windsor to inject a dependency into an ASP.NET MVC model?

I have a a model class that needs access to my repository class (used for DB access). I have created an interface for my repository and have successfully configured Castle Windsor to inject my the appropriate IRepository-based class into my…
1
vote
1 answer

Best way to use an IoC container for retrieving runtime settings

I have an C# dll project for which I have to store the runtime settings in an external XML file, and this dll will be used in an ASP.NET/ASP.NET MVC application for which I also have to store the runtime settings in a external file. Which IoC…
alexandrul
  • 12,856
  • 13
  • 72
  • 99
1
vote
1 answer

Autofac: long-lived objects requiring short-lived objects during single method calls

I have a class X that I register in Autofac as single-instance because it's rather costly to create. X has a method DoSomething that performs some action. However, to do its task in DoSomething, X needs additional dependencies. Typically, I'd inject…
Andre Loker
  • 8,368
  • 1
  • 23
  • 36
1
vote
2 answers

Dependency Injection and .NET Attributes

I have a couple of method attributes which do some logging. Our logging code sits behind an interface (ILog) and I'd like it if the attributes were only dependent upon that interface as opposed to an implementation. This isn't really about…
Zac Seth
  • 2,742
  • 5
  • 37
  • 56
1 2 3
99
100