문제

I would like to get some experience using Unity 3 so I set up a console application and downloaded Unity from nuGet.

However I didn't find any examples on how I can start Unity? Do I need to add some code to my main method to make a Unity container or is it normal to put that code into another file and call that?

Note that I did find the "Unity hands-on labs" but these look far too complicated for a starter tutorial. I would really like to find some starter example coded in C# if anyone has any links bookmared that would be a great help.

도움이 되었습니까?

해결책

http://msdn.microsoft.com/en-us/library/dn178463(v=pandp.30).aspx

Basically, yes, you have to initialize Unity first. Just put this in the beginning of your Main method:

var container = new UnityContainer();
container.RegisterType<IYourType, YourType>();
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top