Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is the Unity Framework any good for Inversion of Control?

I have been using IoC for a little while now and I am curious if I should use Microsoft's Unity framework (official name "Unity Application Block"). Does anyone have experience using it? So for I have been copying my IoC container code from project to project, but I think it would be better to using something standard. I think IoC can make a HUGE difference in keeping component based applications loosely coupled and therefore changeable but I am by no means an expert on IoC, so I am nervous to switch to a framework that will just paint me into a corner as a dependency I will one day want to walk away from.

like image 942
skb Avatar asked Sep 20 '08 03:09

skb


People also ask

When should you not use inversion of control?

You should not use IoC/DI where you cannot demonstrate concrete examples of how the complexity added through the use of IoC/DI is out weighed by the benefits of using IoC/DI.

What is inversion of control framework?

Inversion of Control (IoC) is a design principle that allows classes to be loosely coupled and, therefore, easier to test and maintain. IoC refers to transferring the control of objects and their dependencies from the main program to a container or framework.

What is Unity framework?

Unity is one among the Microsoft Application Blocks. It is basically introduced as an IOC container by Microsoft, which helps in easy object creation and de-coupling the module dependencies in your project. To use it, just add the reference of the Unity DLLs to your project.

What is IoC unity?

Unity Inversion of Control (Unity IoC) Inversion of Control (IoC) is a concept stating that aggregated system modules should not depend on implementation of subordinate modules. Instead, a separate module-container stores abstraction-implementation couple and manages the lifetime of these implementations.


3 Answers

I am using Unity with no real problems. I know a few ALT.NET type people warn against Unity but I really think that is just because of the history the MS P&P team have of writing bloatware. Unity is not yet bloated IMO and works well.

like image 151
Craig Avatar answered Oct 03 '22 00:10

Craig


I took a look at the Unity Framework, but found it to be a little 'too big' for my needs (no, I can't really quantify that, it just seemed to require much more knowledge that other frameworks that I've been playing with... this was a while ago so it's possible that that's changed as Unity's been developed/refined).

My current IoC/Dependency Injection framework is Ninject. It's quick, fast, and I was able to go from reading the tutorials (about 10 minutes) to using it in a pre-existing project in about two hours.

If you're looking for a clean way to do dependency injection, I'd highly recommend checking it out.

like image 22
Peter Bernier Avatar answered Oct 02 '22 23:10

Peter Bernier


I would say stick with the one you know until you feel confident with it and the whole concept. After what you'll have a better judgement to pick a framework which fullfill your needs.

like image 45
pmlarocque Avatar answered Oct 03 '22 00:10

pmlarocque