Exemple #1
0
        public override void SetUp()
        {
            base.SetUp();
            context       = NewMock <IInjectionContext>();
            configuration = NewMock <IContainerConfiguration>();

            abstractionConfiguration = NewMock <IAbstractionConfiguration>();
            type = typeof(int);
            abstractionConfigurationCollection = NewMock <IAbstractionConfigurationCollection>();
            configurator    = NewMock <IContainerConfigurator>();
            creationContext = GetMock <ICreationContext>();
            classFactory    = GetMock <IClassFactory>();
            var implementationConfigurationCache = GetMock <IImplementationConfigurationCache>();
            var implementationCache = GetMock <IImplementationCache>();

            internalContainer =
                new InternalContainer(new TestContext
            {
                AbstractionConfigurationCollection = abstractionConfigurationCollection,
                Configuration                    = configuration,
                ContainerConfigurator            = configurator,
                FuncBuilder                      = new FuncBuilder(),
                CreationContext                  = creationContext,
                ImplementationConfigurationCache = implementationConfigurationCache,
                ImplementationCache              = implementationCache
            });
            context = NewMock <IInjectionContext>();
        }
Exemple #2
0
        public static void Read(InternalContainer container)
        {
            try
            {
                using (ObjectBuilder.UseLocalContainer(container))
                {
                    //No need to do anything if there is nothing configured
                    if (container.ContainerConfiguration.Count == 0)
                    {
                        return;
                    }

                    IEnumerable <IConfigurationRunner> configurationRunners =
                        BooCompilationManager.GetConfigurationRunners(container.ContainerConfiguration);

                    foreach (IConfigurationRunner conf in configurationRunners)
                    {
                        conf.Run();
                    }

                    foreach (Component component in Components)
                    {
                        container.Register(component);
                    }
                }
            }
            finally
            {
                Components.Clear();
            }
        }
Exemple #3
0
        /// <summary>
        /// Queues an action to be executed when the provided viewHolder is being recycled.
        /// </summary>
        internal void RegisterForRecycled(InternalContainer container, Action action)
        {
            if (!_onRecycled.TryGetValue(container, out var actions))
            {
                _onRecycled[container] = actions = new List <Action>();
            }

            actions.Add(action);
        }
 private void DisposeControl()
 {
     if (InternalContainer == null)
     {
         return;
     }
     InternalContainer.Dispose();
     fInternalView = null;
 }
Exemple #5
0
 /// <summary>
 /// 为服务打上一个标签
 /// </summary>
 /// <param name="tag">标签名</param>
 /// <returns>服务绑定数据</returns>
 public IBindData Tag(string tag)
 {
     lock (SyncRoot)
     {
         GuardIsDestroy();
         Guard.NotEmptyOrNull(tag, nameof(tag));
         InternalContainer.Tag(tag, Service);
         return(this);
     }
 }
Exemple #6
0
 /// <summary>
 /// 为服务设定一个别名
 /// </summary>
 /// <param name="alias">别名</param>
 /// <returns>服务绑定数据</returns>
 public IBindData Alias(string alias)
 {
     lock (SyncRoot)
     {
         GuardIsDestroy();
         Guard.NotEmptyOrNull(alias, nameof(alias));
         InternalContainer.Alias(alias, Service);
         return(this);
     }
 }
Exemple #7
0
        public PowerCoreDockingStation(bool link)
        {
            Link = link;

            if (link)
            {
                AddStation();
            }

            AddComplexComponent(40157, 0, 0, 36, 0, 1124171);    // 19
            AddComplexComponent(40157, 1, 0, 36, 0, 1124171);    // 20
            AddComplexComponent(40157, 0, 1, 36, 0, 1124171);    // 21
            AddComplexComponent(40157, 1, 1, 36, 0, 1124171);    // 22
            AddComplexComponent(40146, 0, 0, 11, 2591, 1157023); // 23

            AddComplexComponent(40173, 1, -1, 0, 2591);          // 24
            AddComplexComponent(40173, 2, 0, 0, 2591);           // 24
            AddComplexComponent(40174, 0, 2, 0, 2591);           // 24

            AddComplexComponent(39736, 1, 0, 11, 2591);          // 25
            AddComplexComponent(39728, 0, 1, 11, 2591);          // 26
            AddComplexComponent(39734, 1, 1, 11, 2591);          // 27
            AddComplexComponent(39730, 0, 0, 11, 2591);          // 28
            AddComplexComponent(39714, -1, -1, 0, 2591);         // 29
            AddComplexComponent(39713, -1, 1, 0, 2591);          // 30
            AddComplexComponent(39713, -1, 0, 0, 2591);          // 31
            AddComplexComponent(39712, 0, -1, 0, 2591);          // 32
            AddComplexComponent(39712, 1, -1, 0, 2591);          // 33
            AddComplexComponent(39713, 1, 0, 0, 2591);           // 34
            AddComplexComponent(39712, 0, 1, 0, 2591);           // 35
            AddComplexComponent(39711, 1, 1, 0, 2591);           // 36

            AddComponent(new AddonComponent(0x9CE5), -1, 2, 0);

            Chest1 = new InternalContainer
            {
                Addon = this
            };

            Chest2 = new InternalContainer
            {
                Addon = this
            };
        }
Exemple #8
0
 /// <summary>
 /// 执行服务释放处理器
 /// </summary>
 /// <param name="instance">服务实例</param>
 /// <returns>服务实例</returns>
 internal object TriggerRelease(object instance)
 {
     return(InternalContainer.Trigger(this, instance, release));
 }
Exemple #9
0
 /// <summary>
 /// 执行服务修饰器之后的回调
 /// </summary>
 /// <param name="instance">服务实例</param>
 /// <returns>服务实例</returns>
 internal object TriggerAfterResolving(object instance)
 {
     return(InternalContainer.Trigger(this, instance, afterResolving));
 }
Exemple #10
0
 /// <summary>
 /// 移除绑定服务 , 在解除绑定时如果是静态化物体将会触发释放
 /// </summary>
 protected override void ReleaseBind()
 {
     InternalContainer.Unbind(this);
 }