private static void RegisterComplex()
        {
            var firstService = new FirstService();
            var secondService = new SecondService();
            var thirdService = new ThirdService();

            Injector.SetResolver<IFirstService>(() => firstService);
            Injector.SetResolver<ISecondService>(() => secondService);
            Injector.SetResolver<IThirdService>(() => thirdService);
            Injector.SetResolver<ISubObjectOne, SubObjectOne>();
            Injector.SetResolver<ISubObjectTwo, SubObjectTwo>();
            Injector.SetResolver<ISubObjectThree, SubObjectThree>();

            Injector.SetResolver<IComplex, Complex>();
        }
Exemplo n.º 2
0
        private void RegisterComplex()
        {
            IFirstService firstService = new FirstService();
            ISecondService secondService = new SecondService();
            IThirdService thirdService = new ThirdService();

            this.container[typeof(IFirstService)] = () => firstService;
            this.container[typeof(ISecondService)] = () => secondService;
            this.container[typeof(IThirdService)] = () => thirdService;
            this.container[typeof(IComplex)] = () => new Complex(
                firstService,
                secondService,
                thirdService,
                new SubObjectOne(firstService),
                new SubObjectTwo(secondService),
                new SubObjectThree(thirdService));
        }
 public IFirstService ProvideFirstService(FirstService service)
 {
     return service;
 }