本文整理汇总了C#中System.Runtime.Remoting.Contexts.Context类的典型用法代码示例。如果您正苦于以下问题:C# Context类的具体用法?C# Context怎么用?C# Context使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Context类属于System.Runtime.Remoting.Contexts命名空间,在下文中一共展示了Context类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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;
}
示例2: CreateProxy
public virtual RealProxy CreateProxy(ObjRef objRef, Type serverType,
Object serverObject,
Context serverContext)
{
// TODO
return null;
}
示例3: TestDoCallback
public void TestDoCallback ()
{
otherCtx = cbo.GetContext ();
Assert.IsTrue (Thread.CurrentContext != otherCtx, "New context not created");
otherCtx.DoCallBack (new CrossContextDelegate (DelegateTarget));
}
示例4: IsNewContextOK
public bool IsNewContextOK(Context newCtx)
{
var p = newCtx.GetProperty("Reporting") as ReportingProperty;
if (p == null)
return false;
return true;
}
示例5: CreateProxy
[System.Security.SecurityCritical] // auto-generated
public virtual RealProxy CreateProxy(ObjRef objRef,
Type serverType,
Object serverObject,
Context serverContext)
{
RemotingProxy rp = new RemotingProxy(serverType);
// If this is a serverID, set the native context field in the TP
if (null != serverContext)
{
RealProxy.SetStubData(rp, serverContext.InternalContextID);
}
if (objRef != null && objRef.GetServerIdentity().IsAllocated)
{
rp.SetSrvInfo(objRef.GetServerIdentity(), objRef.GetDomainID());
}
// Set the flag indicating that the fields of the proxy
// have been initialized
rp.Initialized = true;
// Sanity check
Type t = serverType;
if (!t.IsContextful &&
!t.IsMarshalByRef &&
(null != serverContext))
{
throw new RemotingException(
Environment.GetResourceString(
"Remoting_Activation_MBR_ProxyAttribute"));
}
return rp;
}
示例6: IsNewContextOK
public bool IsNewContextOK(Context newCtx)
{
InterceptProperty p = newCtx.GetProperty("Intercept") as InterceptProperty;
if(p == null)
return false;
return true;
}
示例7: AsyncWorkItem
internal AsyncWorkItem(IMessage reqMsg, IMessageSink replySink, Context oldCtx, ServerIdentity srvID)
{
this._reqMsg = reqMsg;
this._replySink = replySink;
this._oldCtx = oldCtx;
this._callCtx = CallContext.GetLogicalCallContext();
this._srvID = srvID;
}
示例8: 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
}
示例9: AddDynamicProperty
internal static bool AddDynamicProperty(Context ctx, IDynamicProperty prop)
{
if (ctx != null)
{
return ctx.AddPerContextDynamicProperty(prop);
}
return AddGlobalDynamicProperty(prop);
}
示例10: IsContextOK
public override bool IsContextOK(Context ctx, IConstructionCallMessage ctorMsg)
{
var p = ctx.GetProperty("Reporting") as ReportingProperty;
if (p == null)
{
return false;
}
return true;
}
示例11: 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
}
示例12: 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;
}
示例13: IsNewContextOK
public bool IsNewContextOK(Context ctx)
{
AOPProperty newContextLogProperty = ctx.GetProperty("AOP") as AOPProperty;
if (newContextLogProperty == null) {
Debug.Assert(false);
return false;
}
return (true);
}
示例14: ProviderValidationProxy
public ProviderValidationProxy(Type type, Type connectionType, bool schemaNameSupported)
: base(type)
{
context = new Context();
context.Freeze();
this.connectionType = connectionType;
this.schemaNameSupported = schemaNameSupported;
}
示例15: IsContextOK
public override bool IsContextOK (Context ctx, IConstructionCallMessage msg)
{
SyncContext sctx = SyncContext.GetContext ();
if (sctx == null || (sctx.GetType() != contextType)) {
syncContext = (SyncContext) Activator.CreateInstance (contextType);
return false;
}
else {
syncContext = sctx;
return true;
}
}