At work, we use Unity a lot. It's great at it's job, but the more you use it, the more your configuration file grows, the more runtime issues increase and the more you have to recreate your unity configuration for each test project.
So we end up with a huge unity configuration section that has to be duplicated accross several projects and when it comes time to deploy, you end up having to track down dlls that you forgot to add references to, but you only discover these at runtime. Not fun.
I'm guessing someone has come across this issue and has a solution. Ideally, I would like to figure out how to configure Unity in a way that makes use of convention over configuration and reduces runtime issues (ie, huge configuration files). Anyone know of a good way to implement Unity with minimal configuration?
Edit: One thing: I have to stick with only using Unity. Can't really switch to Ninject, etc.
Unity can certainly run on 2 – 4GBs of RAM, but it won't be a great experience—especially with 2GBs.
So it will work as long as u have got 64 bit OS. Just for latest versions. If you have 32 bit OS, then still unity will work just the version till 5.6 and not further ones. Thank you!
Though you can run many apps(5 apps before ram issues start), 4GB ram isn't enough to run both Unity and VS studio.
Unity has a configuration API so it's pretty easy to write some auto-configuration code using reflection.
Several people have blogged about it here:
http://geekswithblogs.net/watsonjon/archive/2009/09/28/unity-convention-based-registration.aspx
http://geekswithblogs.net/brians/archive/2010/07/04/convention-based-registration-extension-for-the-microsoft-unity-ioc-container.aspx
Including this one with some framework code you can reuse:
http://thedersen.com/2011/02/20/convention-based-configuration-for-microsoft-unity/
This has been discussed on the Unity discussion board. The issue is that everyone wants different conventions. Look at the blog posts, writing your own seems pretty trivial.
In unity 3.0 you can now do configuration by convention. This blog post explains it in more detail:
http://blogs.msdn.com/b/agile/archive/2013/03/12/unity-configuration-registration-by-convention.aspx
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With