コード例 #1
0
ファイル: Implementation.cs プロジェクト: nbxx/YouCanHackIt
        // Injects all services.
        private void Compose()
        {
            IocContainer container = new IocContainer();
            ServiceLocator.SetLocatorProvider(() => container);

            container.RegisterAssembly<ICalculator>(Assembly.GetExecutingAssembly());
            container.Register<ICalculatorResolver>(c => new CalculatorResolver(c.GetAllInstances<ICalculator>()));
            container.Register<ITaxService>(c => new TaxService(c.Resolve<ICalculatorResolver>()));
            container.Register<Cashier>(c => new Cashier(c.Resolve<ITaxService>()));
        }