All Questions

94
votes
5answers
18497 views

Ioc/DI - Why do I have to reference all layers/assemblies in entry application?

(Related to this question, EF4: Why does proxy creation have to be enabled when lazy loading is enabled?). I'm new to DI so bear with me... I understand that the container is in charge of instantiati...
135
votes
5answers
56244 views

Is there a pattern for initializing objects created via a DI container

I am trying to get Unity to manage the creation of my objects and I want to have some initialization parameters that are not known until run-time: At the moment the only way I could think of the way ...
321
votes
9answers
72053 views

One DbContext per web request... why?

I have been reading a lot of articles explaining how to set up Entity Framework's DbContext so that only one is created and used per HTTP web request using various DI frameworks. Why is this a good i...
209
votes
4answers
32056 views

Dependency Inject (DI) "friendly" library

I'm pondering the design of a C# library, that will have several different high level functions. Of course, those high-level functions will be implemented using the SOLID class design principles as mu...
1303
votes
32answers
332766 views

What is Inversion of Control?

Inversion of Control (or IoC) can be quite confusing when it is first encountered. What is it? What problems does it solve? When is it appropriate and when not?
70
votes
2answers
7686 views

Why not use an IoC container to resolve dependencies for entities/business objects?

I understand the concept behind DI, but I'm just learning what different IoC containers can do. It seems that most people advocate using IoC containers to wire up stateless services, but what about u...
598
votes
30answers
211012 views

Why do I need an IoC container as opposed to straightforward DI code?

I've been using Dependency Injection (DI) for a while, injecting either in a constructor, property, or method. I've never felt a need to use an Inversion of Control (IoC) container. However, the mor...
224
votes
7answers
41085 views

How to avoid Dependency Injection constructor madness?

I find that my constructors are starting to look like this: public MyClass(Container con, SomeClass1 obj1, SomeClass2, obj2.... ) with ever increasing parameter list. Since "Container" is my depend...
330
votes
12answers
114611 views

Which .NET Dependency Injection frameworks are worth looking into?

Which C#/.NET Dependency Injection frameworks are worth looking into? And what can you say about their complexity and speed.
92
votes
4answers
32579 views

Using IoC for Unit Testing

How can a IoC Container be used for unit testing? Is it useful to manage mocks in a huge solution (50+ projects) using IoC? Any experiences? Any C# libraries that work well for using it in unit tests?...

Previous Next