public void Prepare()
        {
            ContainerSettings settings = new DefaultContainerSettings("Speedioc");

            settings.ForceCompile = true;

            IRegistry registry = new Registry();

            registry.Register <Singleton>().As <ISingleton>().WithLifetime(Lifetime.Container).PreCreateInstance();
            registry.Register <Transient>().As <ITransient>().WithLifetime(Lifetime.Transient);
            registry.Register <Combined>().As <ICombined>().WithLifetime(Lifetime.Transient)
            .UsingConstructor()
            .WithResolvedParameter <ISingleton>()
            .WithResolvedParameter <ITransient>()
            .AsLastParameter();

            IContainerBuilder containerBuilder = DefaultContainerBuilderFactory.GetInstance(settings, registry);

            container = containerBuilder.Build();
        }
Пример #2
0
        public override void PrepareBasic()
        {
            ContainerSettings settings = new DefaultContainerSettings("Speedioc");

            settings.ForceCompile = true;

            IRegistry registry = new Registry();

            RegisterDummies(registry);
            RegisterStandard(registry);
            RegisterComplex(registry);

            registry.Register <Singleton1>().As <ISingleton1>().WithLifetime(Lifetime.Container).PreCreateInstance();
            registry.Register <Transient1>().As <ITransient1>().WithLifetime(Lifetime.Transient);
            registry.Register <Combined1>().As <ICombined1>().WithLifetime(Lifetime.Transient)
            .UsingConstructor()
            .WithResolvedParameter <ISingleton1>()
            .WithResolvedParameter <ITransient1>()
            .AsLastParameter();

            IContainerBuilder containerBuilder = DefaultContainerBuilderFactory.GetInstance(settings, registry);

            this.container = containerBuilder.Build();
        }