private static void RegisterStandard()
        {
            var singleton1 = new Singleton1();
            var singleton2 = new Singleton2();
            var singleton3 = new Singleton3();

            Container.SetResolver<ISingleton1>(() => singleton1);
            Container.SetResolver<ISingleton2>(() => singleton2);
            Container.SetResolver<ISingleton3>(() => singleton3);
            Container.SetResolver<ITransient1, Transient1>();
            Container.SetResolver<ITransient2, Transient2>();
            Container.SetResolver<ITransient3, Transient3>();
            Container.SetResolver<ICombined1, Combined1>();
            Container.SetResolver<ICombined2, Combined2>();
            Container.SetResolver<ICombined3, Combined3>();
        }
예제 #2
0
        private void RegisterStandard()
        {
            ISingleton1 singleton1 = new Singleton1();

            this.container[typeof(ISingleton1)] = () => singleton1;
            this.container[typeof(ITransient1)] = () => new Transient1();
            this.container[typeof(ICombined1)] = () => new Combined1(singleton1, new Transient1());

            ISingleton2 singleton2 = new Singleton2();

            this.container[typeof(ISingleton2)] = () => singleton2;
            this.container[typeof(ITransient2)] = () => new Transient2();
            this.container[typeof(ICombined2)] = () => new Combined2(singleton2, new Transient2());

            ISingleton3 singleton3 = new Singleton3();

            this.container[typeof(ISingleton3)] = () => singleton3;
            this.container[typeof(ITransient3)] = () => new Transient3();
            this.container[typeof(ICombined3)] = () => new Combined3(singleton3, new Transient3());
        }