What is Castle Windsor, and why should I care?

I’m a long-time Windows developer, having cut my teeth on win32 and early COM. I’ve been working with .NET since 2001, so I’m pretty fluent in C# and the CLR. I’d never heard of Castle Windsor until I started participating in Stack Overflow. I’ve read the Castle Windsor “Getting Started” guide, but it’s not clicking. … Read more

How to explain dependency injection to a 5-year-old? [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for … Read more

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 much as possible. As such, there will probably be classes intended for consumers to use directly on a regular basis, and “support classes” that … Read more

Do I need dependency injection in NodeJS, or how to deal with …?

I currently creating some experimental projects with nodejs. I have programmed a lot Java EE web applications with Spring and appreciated the ease of dependency injection there. Now I am curious: How do I do dependency injection with node? Or: Do I even need it? Is there a replacing concept, because the programming style is … Read more

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 dependency injection container, why can’t I just do this: public MyClass(Container con) for every class? What are the downsides? If I do this, it feels like I’m … Read more

Why is IoC / DI not common in Python?

In Java IoC / DI is a very common practice which is extensively used in web applications, nearly all available frameworks and Java EE. On the other hand, there are also lots of big Python web applications, but beside of Zope (which I’ve heard should be really horrible to code) IoC doesn’t seem to be … Read more

Which .NET Dependency Injection frameworks are worth looking into? [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for … Read more

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

Closed. This question is opinion-based. It is not currently accepting answers. Closed 8 years ago. Locked. This question and its answers are locked because the question is off-topic but has historical significance. It is not currently accepting new answers or interactions. I’ve been using Dependency Injection (DI) for a while, injecting either in a constructor, … Read more

Inversion of Control vs Dependency Injection

According to the paper written by Martin Fowler, inversion of control is the principle where the control flow of a program is inverted: instead of the programmer controlling the flow of a program, the external sources (framework, services, other components) take control of it. It’s like we plug something into something else. He mentioned an … Read more

SqlException from Entity Framework – New transaction is not allowed because there are other threads running in the session

I am currently getting this error: System.Data.SqlClient.SqlException: New transaction is not allowed because there are other threads running in the session. while running this code: public class ProductManager : IProductManager { #region Declare Models private RivWorks.Model.Negotiation.RIV_Entities _dbRiv = RivWorks.Model.Stores.RivEntities(AppSettings.RivWorkEntities_connString); private RivWorks.Model.NegotiationAutos.RivFeedsEntities _dbFeed = RivWorks.Model.Stores.FeedEntities(AppSettings.FeedAutosEntities_connString); #endregion public IProduct GetProductById(Guid productId) { // Do a quick sync … Read more