Thursday, February 16, 2012

All in One Unity Demo and Information Series

CodePlex - Unity All In One

This projects intends to show features in Unity and different ways of working with it.

A couple of thing to know before starting is how the project is structured. The launching point for this project is UnityDemo.ConsolePresenter which has the Program files. To make it more relatable i've used the Duck analogy from HeadFirst deisgn pattern but in my own way. Solution has a Common and a Unity code Library folder where all the samples lie. Feature's are mostly broken down as assemblies . It's best to start with UnityDemo.RegAndResCode project but after that you can go through any feature you like. For convenience sake I have a dictionary or Features and within it a dictionary of Samples. All you have to do is change the index number to go directly to the code class. A detailed explanation about each feature can be found here

Features sampled uptill now are :

  1. Regitsering types
  2. Resolving Types
  3. ResolveAll
  4. DependencyAttribute
  5. LifeTime manager
    1. Transient
    2. ExternalControlled
    3. ContainerControlled
    4. PerThreadControlled
    5. HierarchicalLifetimeManager
  6. Injcetion constructor
  7. AutomaticFactory
  8. Interception
  9. Confuration File
    1. Adding Intellisense Support

..." [GD: Project Description Leach Level: 99%]

Unity All in One : 2 of N : Adding Intellisense in the App.config

"Visual studio Intellisense is one of the best feature’s in Microsoft arsenal. So if at any point I don’t have it working for me I end up spending more time then I probably should be. This is specially true while configuring the config file for Unity. May be I’m jumping ahead. Lets step back to the most crucial question here

“Why should i use a config file at all for Unity ? “

I generally tend to have behaviours and model split across assemblies. So there may be a situation where I havent referenced an assembly. But I know that by the time you get here it’ll be registered. So no harm done. But that just me.

Ok moving forward. How do I get an Intellisense in the config file for Unity configurations ? . The problem is Visual studio doesn’t have a schema defined for the Unity’s configuration section. A simple way would be to install the Enterprise Library by Microsoft. It come with a schema for Unity. To verify if you have a schema follow the mentioned steps


This looks like a great resource, both the Codeplex Project and the blog, for getting up to speed and checking out Unity...


(via Microsoft Developer Network - Samples - Unity All In One)

No comments: