views:

384

answers:

1

I'm looking for unity tutorials that aren't a download, rather a walk through on a webpage that I can follow along, So far I've found 6 or so tutorials that all use configuration files. I've been doing my own poor man's dependency injection and wanted to pick up a framework finally, so I don't need IoC or DI explained, which many of the tutorials try to go in depth about as well.

+1  A: 

The Unity StopLight QuickStart on MSDN shows you how to setup a container programatically, rather than via a configuration file.

http://msdn.microsoft.com/en-us/library/dd203173.aspx

I think that's what you're looking for.

The following doc also contains more detail on configuring containers programatically at runtime:

http://msdn.microsoft.com/en-us/library/dd203208.aspx

Ade

Ade Miller
I was looking at the first article when I posted this, Microsoft's explanation isn't as detailed, applied or made simple enough in that article. I stopped trying to follow it as soon as I couldn't find the WHERE behind initializing the container. I wanted to know if I needed to keep that container alive after doing the configuration or not. So I went looking for others, that might provide a better context.
Maslow
Thanks for the feedback. We're working on new documentation which will ship with Unity 2.0 in a few months.To try and answer your question you only need to keep the container if you intend to resolve further objects from it. If you create a container and then resolve a type from it this will return an object graph which is essentially independent from the container. You can keep the object graph you resolved and dispose of the container in this case.
Ade Miller