Пример #1
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(IComplex1)]      = () => new Complex1(
                firstService,
                secondService,
                thirdService,
                new SubObjectOne(firstService),
                new SubObjectTwo(secondService),
                new SubObjectThree(thirdService));
            this.container[typeof(IComplex2)] = () => new Complex2(
                firstService,
                secondService,
                thirdService,
                new SubObjectOne(firstService),
                new SubObjectTwo(secondService),
                new SubObjectThree(thirdService));
            this.container[typeof(IComplex3)] = () => new Complex3(
                firstService,
                secondService,
                thirdService,
                new SubObjectOne(firstService),
                new SubObjectTwo(secondService),
                new SubObjectThree(thirdService));
        }
        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>();
        }
Пример #3
0
 public ISecondService ProvideSecondService(SecondService service)
 {
     return(service);
 }
Пример #4
0
 public Consumer2(SecondService service)
 {
     this.service = service;
 }
 public ISecondService ProvideSecondService(SecondService service) => service;
 public ValuesController(IService service, SecondService secondService)
 {
     _service       = service;
     _secondService = secondService;
 }
 public HomeController(IService service, SecondService secondService)
 {
     _service       = service;
     _secondService = secondService;
 }
Пример #8
0
 // ReSharper disable UnusedParameter.Local
 public ThirdService(FirstService firstService, SecondService secondService)
 {
 }