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
2 answers

Is there a better way to express this fluent registration in Windsor?

Basically I would like a way to express: Find all classes with base class AbstractDataService<> and resolve them by their interface and not by their base class. I currently have this and it works but it isn't very…
the_drow
  • 18,571
  • 25
  • 126
  • 193
1
vote
1 answer

MsTest - Mocking a DbContext with DbContextOption and configuration

I have 2 project, Data and Data.test, I use ef core and .net core for both of them, for Data project I have ExpenseDb like this: public class ExpenseDb: DbContext { private IConfigurationRoot _config; public…
1
vote
1 answer

How to create a launcher project for ASP.Net MVC Project

I'm a newbie to IoC and dependency injection and Onion Architecture. I am trying to create my solution architecture according to guidelines and best practices in Onion Architecture community. In my VS Solution, I have some projects for the domain…
1
vote
2 answers

S#arp Architecture :: IoC with Custom MembershipProvider

I´m using the lastest S#arp Architecture version... In my project, I´m implementing a Custom MembershipProvider... First question, Where is the right place to put it? I choose Core project... Second question, How work IoC with custom…
Paul
  • 12,359
  • 20
  • 64
  • 101
1
vote
0 answers

Castle Windsor does not release transient component consistently

I'm creating an WPF application with MVVM pattern and Castle Windsor as IoC container. Problem is that windsor seams to inconsistently releases my components. I've got the following components: TypedFactory for Views MainView (Transient) +…
1
vote
2 answers

IoC and DI - architecture & implementation examples

I have been reading about ths approach and understand the theoretical part to a certain degree. However, I wanted to ask the community to share their real life experience of where and how they applied this technique as well how their software had…
dexter
  • 7,063
  • 9
  • 54
  • 71
1
vote
1 answer

Is it okay to reference WebClient from my MVC controller?

I need to download a page from my controller and use Webclient to do so, which isn't Mockable? How do I test around this or can I just leave the direct reference in there?
Jon Gallant
  • 181
  • 1
  • 6
1
vote
2 answers

Spring Boot JMS AutoStartup

I am trying to start/stop manually JMS listeners in my Spring Boot App. I am currently using the following configuration to my container factory: @EnableJms public class ConfigJms { ... @Bean(name = "queueContainerFactory") public…
crm86
  • 1,394
  • 1
  • 21
  • 44
1
vote
1 answer

RegisterType (typeof) vs RegisterType

Do the following two pieces of code do exactly the same thing? .RegisterType() and .RegisterType(typeof(ICrmService), typeof(CrmService))
Alex Gordon
  • 57,446
  • 287
  • 670
  • 1,062
1
vote
1 answer

How to perform conditional binding in StructureMap from within a registry and without the use of generics?

I am familiar with Ninject and in Ninject you can do something similar to Bind().To().WhenInjectedInto(typeof(Roster)).InRequestScope(); I'm not sure how to perform something similar in StructureMap. I need to be able to…
Joshua Hayes
  • 1,938
  • 2
  • 21
  • 39
1
vote
1 answer

.Net Native IoC container registration issue on Release mode

Application works as it should be on Debug mode. On Release mode I am getting exception saying Exception thrown: 'Autofac.Core.Registration.ComponentNotRegisteredException' in Autofac.dll Additional information: The requested service…
TIKSN
  • 615
  • 1
  • 6
  • 24
1
vote
3 answers

ASP.MVC and mvccontrib fluent test with IOC

I am trying to use the fluent test helpers to test an AbstractRestfulFluentController public class CustomerController : AbstractRestfulFluentController { private readonly IService _customerService; private readonly…
Firestrand
  • 1,305
  • 10
  • 19
1
vote
2 answers

Unity: The current type,'XXXXX', is an interface and cannot be constructed. Are you missing a type mapping?

I have multiple types that are derived from the same interface. And I am using Unity IOC container to register the types public interface IService { } public class ServiceA : IService { } public class ServiceB : IService { } public class…
LP13
  • 30,567
  • 53
  • 217
  • 400
1
vote
1 answer

Spring Boot dynamic context creation (parent/child)

I am using Spring Boot with Spring Integration and I would like to load different properties for each child() context. Is this possible? At this moment, I am working with this: (only the most relevant lines) SpringApplicationBuilder parent = new…
crm86
  • 1,394
  • 1
  • 21
  • 44
1
vote
3 answers

IoC lifetime difference

I am a newbie in C #, and just started to learn IoC in web api. What is the difference in Transient and PerWebRequest lifestyles Sorry for bad English.
Developer
  • 66
  • 1
  • 6