Esempio n. 1
0
        override public void ResolveBinding(IBinding binding, object key)
        {
            //Decide whether to resolve locally or not
            if (binding is IInjectionBinding)
            {
                InjectionBinding injectionBinding = (InjectionBinding)binding;
                if (injectionBinding.isCrossContext)
                {
                    if (CrossContextBinder == null) //We are a crosscontextbinder
                    {
                        base.ResolveBinding(binding, key);
                    }
                    else
                    {
                        Unbind(key); //remove this cross context binding from the local binder
                        CrossContextBinder.ResolveBinding(binding, key);

                        //Need to bring over any values from the local injector factory
                        // This is the local injector
                        object value = injector.factory.Get(injectionBinding);

                        if (value != null)
                        {
                            // Move bound value to cross context
                            CrossContextBinder.injector.factory.ManualSet(injectionBinding, value);
                        }
                    }
                }
                else
                {
                    base.ResolveBinding(binding, key);
                }
            }
        }
Esempio n. 2
0
 override public void ResolveBinding(IBinding binding, object key)
 {
     //Decide whether to resolve locally or not
     if (binding is IInjectionBinding)
     {
         InjectionBinding injectionBinding = (InjectionBinding)binding;
         if (injectionBinding.isCrossContext)
         {
             if (CrossContextBinder == null)                     //We are a crosscontextbinder
             {
                 base.ResolveBinding(binding, key);
             }
             else
             {
                 base.Unbind(key, binding.name); //remove this cross context binding from ONLY the local binder
                 CrossContextBinder.ResolveBinding(binding, key);
             }
         }
         else
         {
             base.ResolveBinding(binding, key);
         }
     }
 }