Exemplo n.º 1
0
        private IStashboxContainer RegisterFuncInternal(Delegate factory, Type factoryType, string name)
        {
            var data = RegistrationContextData.New();

            data.Name         = name;
            data.FuncDelegate = factory;

            var registration = new ServiceRegistration(factoryType, this.ContainerContext.ContainerConfigurator,
                                                       this.objectBuilderSelector, data, false, false);

            this.registrationRepository.AddOrUpdateRegistration(registration, factoryType, false, false);
            this.containerExtensionManager.ExecuteOnRegistrationExtensions(this.ContainerContext, registration);
            return(this);
        }
Exemplo n.º 2
0
        private void WireUpInternal(object instance, object keyName, Type typeFrom, Type typeTo, bool withoutDisposalTracking, object finalizerDelelgate = null)
        {
            var data = RegistrationContextData.New();

            data.Name             = keyName;
            data.ExistingInstance = instance;
            data.Finalizer        = finalizerDelelgate;

            var registration = new ServiceRegistration(typeFrom, typeTo,
                                                       this.ContainerContext, this.objectBuilderSelector.Get(ObjectBuilder.WireUp),
                                                       data, false, !withoutDisposalTracking);

            this.registrationRepository.AddOrUpdateRegistration(registration, keyName ?? typeTo, false, false);
            this.containerExtensionManager.ExecuteOnRegistrationExtensions(this.ContainerContext, registration);
        }
Exemplo n.º 3
0
        private IDependencyRegistrator RegisterFuncInternal(Delegate factory, Type factoryType, string name)
        {
            var internalFactoryType = factory.GetType();

            var data = RegistrationContextData.New();

            data.Name         = name;
            data.FuncDelegate = factory;

            var registration = new ServiceRegistration(factoryType, internalFactoryType,
                                                       this.ContainerContext, this.objectBuilderSelector.Get(ObjectBuilder.Func),
                                                       data, false, false);

            this.registrationRepository.AddOrUpdateRegistration(registration, name ?? (object)internalFactoryType, false, false);
            this.containerExtensionManager.ExecuteOnRegistrationExtensions(this.ContainerContext, registration);
            return(this);
        }