本文整理汇总了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;
}
示例2: IsNewContextOK
public bool IsNewContextOK(Context newCtx)
{
var p = newCtx.GetProperty("Reporting") as ReportingProperty;
if (p == null)
return false;
return true;
}
示例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;
}
示例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
}
示例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
}
示例6: IsNewContextOK
public bool IsNewContextOK(Context ctx)
{
AOPProperty newContextLogProperty = ctx.GetProperty("AOP") as AOPProperty;
if (newContextLogProperty == null) {
Debug.Assert(false);
return false;
}
return (true);
}
示例7: IsContextOK
public override bool IsContextOK(Context ctx, IConstructionCallMessage ctorMsg)
{
var p = ctx.GetProperty("Reporting") as ReportingProperty;
if (p == null)
{
return false;
}
return true;
}
示例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;
}
示例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
}
示例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;
}
}
示例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);
}
示例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;
}
示例13: IsContextOK
public override bool IsContextOK(Context ctx, IConstructionCallMessage ctorMsg)
{
var p = (InterceptProperty)ctx.GetProperty("Intercept");
return p != null;
}
示例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;
}
示例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;
}