0

I'm using old version of Castle Windsor - 2.5.1 and ASP.NET MVC. Can I use dependency injection for class other then controllers? I got some services which I'm using in my ASP.NET MVC project and I would like to inject some object to those service in those constructors. Is that possible?

1
  • 1
    What did you try before posting this question? Commented Apr 12, 2016 at 8:12

3 Answers 3

2

Yes of course you can use this. Inversion of Control is a principle used by frameworks as a way to allow developers to extend the framework or create applications using it. The basic idea is that the framework is aware of the programmer’s objects and makes invocations on them.

Hope this helps.

Sign up to request clarification or add additional context in comments.

Comments

1

Yes, you can use dependency injection any any C# or non C# class. In web, desktop, console app. Anywhere. The same way.

1 Comment

I've to check why but it doesn't want to work for not a constructor classes - should work out of the box...
1

Yes you can! Castle Windsor is just an framework to help with dependency injection you can use it with any code - not just ASP.Net MVC and controller classes.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.