예제 #1
0
        static void Main(string[] args)
        {
            AppKernel = new StandardKernel(new WeaponNinjectModule());

            var warrior = AppKernel.Get <Warrior>();

            warrior.Kill();

            var otherWarrior = new OtherWarrior();

            otherWarrior.Kill();

            var anotherWarrior = AppKernel.Get <AnotherWarrior>();

            anotherWarrior.Kill();

            Console.ReadLine();
        }
예제 #2
0
파일: main.cs 프로젝트: staherianYMCA/test
        static void Main(string[] args)
        {
            Container = new UnityContainer();
            Container.RegisterType(typeof(IWeapon), typeof(Bazuka));

            var serviceProvider = new UnityServiceLocator(Container);

            ServiceLocator.SetLocatorProvider(() => serviceProvider);

            var warrior = Container.Resolve <Warrior>();

            warrior.Kill();

            var otherWarrior = new OtherWarrior();

            otherWarrior.Kill();

            Console.ReadLine();
        }