Tuesday, March 1, 2011

Where is the code for the Unity Container in the Composite Application Library?

I'm working with the Composite Application Library and I come across e.g. this line:

Shell shell = Container.Resolve<Shell>();

so I want to look at the code that makes up the Resolve method.

So I open up CompositeApplicationLibrary_Desktop.sln in Visual Studio.

I find classes such as UnityBootstrapper.cs, but nowhere can I find the code for the UnityContainer class. I find references to it such as:

UnityContainer container = new UnityContainer();

but if I rightclick on "UnityContainer()" and choose "go to definition" all I get is meta data about this class.

Where can I look at the code for the Resolve method on the UnityContainer class?

From stackoverflow
  • You can also download just the Unity Application block. There is a zip file in that package that includes only Unity source.

    The Resolve method can be found in there for sure (for example, that method calls DoBuildUp()...)

    Edward Tanguay : ok, I found that, executed it, it created files in c:\EntLib41Src, but there is no files called UnityContainer.cs and opening C:\EntLib41Src\Blocks\EnterpriseLibrary.sln in visual studio, I rightclick on "new UnityContainer()" and get meta data again. Where can the code be?
    Doug L. : I added the download link for the Unity application block. I searched the source that comes with it and found the resolve method in there.
    Edward Tanguay : Excellent, all the classes are there, thanks!

0 comments:

Post a Comment