PeekActivationAttributes() static private méthode

static private PeekActivationAttributes ( Type serverType ) : Object[]
serverType System.Type
Résultat Object[]
        private static bool IsCurrentContextOK(RuntimeType serverType, object[] props, ref ConstructorCallMessage ctorCallMsg)
        {
            object[] objArray1 = ActivationServices.PeekActivationAttributes((Type)serverType);
            if (objArray1 != null)
            {
                ActivationServices.PopActivationAttributes((Type)serverType);
            }
            object[] objArray2 = new object[1] {
                (object)ActivationServices.GetGlobalAttribute()
            };
            object[] objArray3      = (object[])ActivationServices.GetContextAttributesForType((Type)serverType);
            Context  currentContext = Thread.CurrentContext;

            ctorCallMsg           = new ConstructorCallMessage(objArray1, objArray2, objArray3, serverType);
            ctorCallMsg.Activator = (IActivator) new ConstructionLevelActivator();
            bool flag = ActivationServices.QueryAttributesIfContextOK(currentContext, (IConstructionCallMessage)ctorCallMsg, objArray2);

            if (flag)
            {
                flag = ActivationServices.QueryAttributesIfContextOK(currentContext, (IConstructionCallMessage)ctorCallMsg, objArray1);
                if (flag)
                {
                    flag = ActivationServices.QueryAttributesIfContextOK(currentContext, (IConstructionCallMessage)ctorCallMsg, objArray3);
                }
            }
            return(flag);
        }
        private static bool IsCurrentContextOK(RuntimeType serverType, object[] props, ref ConstructorCallMessage ctorCallMsg)
        {
            object[] array = ActivationServices.PeekActivationAttributes(serverType);
            if (array != null)
            {
                ActivationServices.PopActivationAttributes(serverType);
            }
            object[] array2 = new object[]
            {
                ActivationServices.GetGlobalAttribute()
            };
            object[] contextAttributesForType = ActivationServices.GetContextAttributesForType(serverType);
            Context  currentContext           = Thread.CurrentContext;

            ctorCallMsg           = new ConstructorCallMessage(array, array2, contextAttributesForType, serverType);
            ctorCallMsg.Activator = new ConstructionLevelActivator();
            bool flag = ActivationServices.QueryAttributesIfContextOK(currentContext, ctorCallMsg, array2);

            if (flag)
            {
                flag = ActivationServices.QueryAttributesIfContextOK(currentContext, ctorCallMsg, array);
                if (flag)
                {
                    flag = ActivationServices.QueryAttributesIfContextOK(currentContext, ctorCallMsg, contextAttributesForType);
                }
            }
            return(flag);
        }
        private static MarshalByRefObject CreateObjectForCom(RuntimeType serverType, object[] props, bool bNewObj)
        {
            if (ActivationServices.PeekActivationAttributes((Type)serverType) != null)
            {
                throw new NotSupportedException(Environment.GetResourceString("NotSupported_ActivForCom"));
            }
            ActivationServices.InitActivationServices();
            ProxyAttribute proxyAttribute = ActivationServices.GetProxyAttribute((Type)serverType);

            return(!(proxyAttribute is ICustomFactory) ? (MarshalByRefObject)Activator.CreateInstance((Type)serverType, true) : ((ICustomFactory)proxyAttribute).CreateInstance((Type)serverType));
        }