当前位置: 首页>>代码示例>>C#>>正文


C# Context.GetProperty方法代码示例

本文整理汇总了C#中System.Runtime.Remoting.Contexts.Context.GetProperty方法的典型用法代码示例。如果您正苦于以下问题:C# Context.GetProperty方法的具体用法?C# Context.GetProperty怎么用?C# Context.GetProperty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Runtime.Remoting.Contexts.Context的用法示例。


在下文中一共展示了Context.GetProperty方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: IsNewContextOK

 public bool IsNewContextOK(Context newCtx)
 {
     InterceptProperty p = newCtx.GetProperty("Intercept") as InterceptProperty;
     if(p == null)
         return false;
     return true;
 }
开发者ID:royosherove,项目名称:dotnet-test-extensions,代码行数:7,代码来源:InterceptProperty.cs

示例2: IsNewContextOK

		public bool IsNewContextOK(Context newCtx)
		{
			var p = newCtx.GetProperty("Reporting") as ReportingProperty;
			if (p == null)
				return false;
			return true;
		}
开发者ID:kirkchen,项目名称:SpecFlow.Reporting,代码行数:7,代码来源:ReportingProperty.cs

示例3: IsContextOK

 public override bool IsContextOK(Context ctx, System.Runtime.Remoting.Activation.IConstructionCallMessage ctorMsg)
 {
     InterceptProperty p = ctx.GetProperty("Intercept") as InterceptProperty;
     if (p == null)
         return false;
     return true;
 }
开发者ID:WrongDog,项目名称:Aspect,代码行数:7,代码来源:Intercept.cs

示例4: IsNewContextOK

        /// <summary>
        /// permet de vérifier que le context est ok apres son initialisation
        /// </summary>
        /// <param name="newCtx">le context qui vient d'etre créé</param>
        /// <returns>True : le contexte contient bien une propriété appelé "ValidationData". False sinon.</returns>
        public bool IsNewContextOK(Context newCtx)
        {
            DataValidationProperty prop=newCtx.GetProperty("DataValidation") as DataValidationProperty;
            if (prop!=null)	// on a une propriété appelé ValidationData dans le contexte ?
                return true;	// Oui -> on accepte le contexte

            return false;	// Non -> on refuse le contexte
        }
开发者ID:flyingoverclouds,项目名称:sfinx,代码行数:13,代码来源:DataValidationProperty.cs

示例5: IsContextOK

        //Le runtime .NET interroge pour savoir si le contexte courant est valide.
        //Si cette fonction false, le runtime créé un nouveau contexte et appelle GetPropertiesForNewContext()
        // pour vérifier si le context est valid, on vérifie la présence (et la validité si besoin) d'un propriété
        public override bool IsContextOK(Context ctx,IConstructionCallMessage ctorMsg)
        {
            //return false;	// Seulement si vous souhaitez un contexte par instance !
            DataValidationProperty prop=ctx.GetProperty("DataValidation") as DataValidationProperty;
            if (prop!=null)	// on a une propriété appelé ValidationData dans le contexte ?
                return true;	// Oui -> on accepte le contexte

            return false;	// Non -> on refuse le contexte
        }
开发者ID:flyingoverclouds,项目名称:sfinx,代码行数:12,代码来源:DataValidationAttribute.cs

示例6: IsNewContextOK

 public bool IsNewContextOK(Context ctx)
 {
     AOPProperty newContextLogProperty = ctx.GetProperty("AOP") as AOPProperty;
     if (newContextLogProperty == null) {
         Debug.Assert(false);
         return false;
     }
     return (true);
 }
开发者ID:liaoyu45,项目名称:LYCodes,代码行数:9,代码来源:AOPProperty.cs

示例7: IsContextOK

 public override bool IsContextOK(Context ctx, IConstructionCallMessage ctorMsg)
 {
     var p = ctx.GetProperty("Reporting") as ReportingProperty;
     if (p == null)
     {
         return false;
     }
     return true;
 }
开发者ID:shuai-zh,项目名称:SpecResults,代码行数:9,代码来源:ReportingAttribute.cs

示例8: CheckContext

		public SynchRes CheckContext (Context ctx)
		{
			object otherp = ctx.GetProperty ("Synchronization");
			object thisp = Thread.CurrentContext.GetProperty ("Synchronization");

			if (thisp == null) return SynchRes.NoSync;
			if (thisp == otherp) return SynchRes.SameSync;
			return SynchRes.NewSync;
		}
开发者ID:jjenki11,项目名称:blaze-chem-rendering,代码行数:9,代码来源:SynchronizationAttributeTest.cs

示例9: IsContextOK

        //Le runtime .NET interroge l'attribut pour savoir si le contexte courant est valide.
        //Si cette fonction renvoi false, le runtime créé un nouveau contexte et appelle GetPropertiesForNewContext()
        // pour vérifier si le context est valid, on vérifie la présence (et la validité si besoin) d'une propriété
        public override bool IsContextOK(Context ctx,IConstructionCallMessage ctorMsg)
        {
            //le return false permet de forcer systématiquement un nouveau contexte pour chaqueinstance
            // utilise si une instance d'un type créé des instance de ce meme type : vous pouvez intercepter
            // les appels entre instance d'un meme type ( car il y aura changement de contexte )
            //return false;

            InterceptionAppelProperty prop=ctx.GetProperty("InterceptionAppelProperty") as InterceptionAppelProperty;
            if (prop!=null)	// on a une propriété appelé InterceptionAppelProperty dans le contexte ?
                return true;	// Oui -> on accepte le contexte

            return false;	// Non -> on refuse le contexte
        }
开发者ID:flyingoverclouds,项目名称:sfinx,代码行数:16,代码来源:InterceptionAppelAttribute.cs

示例10: IsContextOK

 public override bool IsContextOK(Context ctx,
     System.Runtime.Remoting.Activation.IConstructionCallMessage ctorMsg)
 {
     try
     {
         InterceptProperty p = ctx.GetProperty("Intercept") as InterceptProperty;
         if (p == null)
             return false;
         return true;
     }
     catch (Exception e)
     {
         SeleniumLog log = SeleniumLog.Instance();
         log.Warning().WriteLine("SeleniumLog Exception: 01-08 - " + e.Message);
         return false;
     }
 }
开发者ID:jredimer2,项目名称:SeleniumLog_NET_Extension,代码行数:17,代码来源:InterceptMethodCalls.cs

示例11: DoCrossContextActivation

 internal static IConstructionReturnMessage DoCrossContextActivation(IConstructionCallMessage reqMsg)
 {
     bool isContextful = reqMsg.ActivationType.IsContextful;
     Context newCtx = null;
     if (isContextful)
     {
         newCtx = new Context();
         ArrayList contextProperties = (ArrayList) reqMsg.ContextProperties;
         RuntimeAssembly asm = null;
         for (int i = 0; i < contextProperties.Count; i++)
         {
             IContextProperty prop = contextProperties[i] as IContextProperty;
             if (prop == null)
             {
                 throw new RemotingException(Environment.GetResourceString("Remoting_Activation_BadAttribute"));
             }
             asm = (RuntimeAssembly) prop.GetType().Assembly;
             CheckForInfrastructurePermission(asm);
             if (newCtx.GetProperty(prop.Name) == null)
             {
                 newCtx.SetProperty(prop);
             }
         }
         newCtx.Freeze();
         for (int j = 0; j < contextProperties.Count; j++)
         {
             if (!((IContextProperty) contextProperties[j]).IsNewContextOK(newCtx))
             {
                 throw new RemotingException(Environment.GetResourceString("Remoting_Activation_PropertyUnhappy"));
             }
         }
     }
     InternalCrossContextDelegate ftnToCall = new InternalCrossContextDelegate(ActivationServices.DoCrossContextActivationCallback);
     object[] args = new object[] { reqMsg };
     if (isContextful)
     {
         return (Thread.CurrentThread.InternalCrossContextCallback(newCtx, ftnToCall, args) as IConstructionReturnMessage);
     }
     return (ftnToCall(args) as IConstructionReturnMessage);
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:40,代码来源:ActivationServices.cs

示例12: IsContextOK

        public override bool IsContextOK(Context ctx, IConstructionCallMessage msg)
        {
            if (ctx == null)
                throw new ArgumentNullException("ctx");
            if (msg == null)
                throw new ArgumentNullException("msg");
            Contract.EndContractBlock();

            // <

            bool isOK = true;
            if (_flavor == REQUIRES_NEW)
            {
                isOK = false;
                // Each activation request instantiates a new attribute class.
                // We are relying on that for the REQUIRES_NEW case!
                Contract.Assert(ctx.GetProperty(PROPERTY_NAME) != this,
                    "ctx.GetProperty(PROPERTY_NAME) != this");
            }
            else
            {
                SynchronizationAttribute syncProp = (SynchronizationAttribute) ctx.GetProperty(PROPERTY_NAME);
                if (   ( (_flavor == NOT_SUPPORTED)&&(syncProp != null) )
                    || ( (_flavor == REQUIRED)&&(syncProp == null) )
                    )
                {
                    isOK = false;
                }

                if (_flavor == REQUIRED)
                {
                    // pick up the property from the current context
                    _cliCtxAttr = syncProp;
                }
            }
            return isOK;
        }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:37,代码来源:SynchronizedDispatch.cs

示例13: IsContextOK

 public override bool IsContextOK(Context ctx, IConstructionCallMessage ctorMsg)
 {
     var p = (InterceptProperty)ctx.GetProperty("Intercept");
     return p != null;
 }
开发者ID:ilkerhalil,项目名称:Interception_Sample_BE,代码行数:5,代码来源:InterceptAttribute.cs

示例14: DoCrossContextActivation

        [System.Security.SecurityCritical]  // auto-generated
        internal static IConstructionReturnMessage DoCrossContextActivation(
            IConstructionCallMessage reqMsg)
        {           
            bool bCtxBound = reqMsg.ActivationType.IsContextful;
            Context serverContext = null;
            
            if (bCtxBound)
            {
                // If the type is context bound, we need to create 
                // the appropriate context and activate the object inside
                // it.
                // <

                // Create a new Context
                serverContext = new Context();              

                // <



                
                ArrayList list = (ArrayList) reqMsg.ContextProperties;
                RuntimeAssembly asm = null;
                for (int i=0; i<list.Count; i++)
                {
                    IContextProperty prop = list[i] as IContextProperty;
                    if (null == prop)
                    {
                        throw new RemotingException(
                            Environment.GetResourceString(
                                "Remoting_Activation_BadAttribute"));
                    }
                    asm = (RuntimeAssembly)prop.GetType().Assembly;
                    // Make a security check to ensure that the context property
                    // is from a trusted assembly!
                    CheckForInfrastructurePermission(asm);

                    // This ensures that we don't try to add duplicate
                    // attributes (eg. type attributes common on both client
                    // and server end)
                    if (serverContext.GetProperty(prop.Name) == null)
                    {
                        serverContext.SetProperty(prop);
                    }
                }
                // No more property changes to the server context from here.
                serverContext.Freeze();

                // (This seems like an overkill but that is how it is spec-ed)
                // Ask each of the properties in the context we formed from
                // if it is happy with the current context.
                for (int i=0; i<list.Count;i++)
                {
                    if (!((IContextProperty)list[i]).IsNewContextOK(
                        serverContext))
                    {
                        throw new RemotingException(
                            Environment.GetResourceString(
                                "Remoting_Activation_PropertyUnhappy"));
                    }
                }
            }


            IConstructionReturnMessage  replyMsg;

            InternalCrossContextDelegate xctxDel = 
                new InternalCrossContextDelegate(DoCrossContextActivationCallback);

            Object[] args = new Object[] { reqMsg };
            
            if (bCtxBound)
            {
                replyMsg = Thread.CurrentThread.InternalCrossContextCallback(
                    serverContext, xctxDel, args) as IConstructionReturnMessage;
            }
            else
            {
                replyMsg = xctxDel(args) as IConstructionReturnMessage;
            }

            return replyMsg;
        }
开发者ID:uQr,项目名称:referencesource,代码行数:84,代码来源:activationservices.cs

示例15: IsContextOK

 public override bool IsContextOK(Context ctx, IConstructionCallMessage msg)
 {
     if (ctx == null)
     {
         throw new ArgumentNullException("ctx");
     }
     if (msg == null)
     {
         throw new ArgumentNullException("msg");
     }
     bool flag = true;
     if (this._flavor == 8)
     {
         return false;
     }
     SynchronizationAttribute property = (SynchronizationAttribute) ctx.GetProperty("Synchronization");
     if (((this._flavor == 1) && (property != null)) || ((this._flavor == 4) && (property == null)))
     {
         flag = false;
     }
     if (this._flavor == 4)
     {
         this._cliCtxAttr = property;
     }
     return flag;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:26,代码来源:SynchronizationAttribute.cs


注:本文中的System.Runtime.Remoting.Contexts.Context.GetProperty方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。