本文整理汇总了C#中IConstructionCallMessage类的典型用法代码示例。如果您正苦于以下问题:C# IConstructionCallMessage类的具体用法?C# IConstructionCallMessage怎么用?C# IConstructionCallMessage使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IConstructionCallMessage类属于命名空间,在下文中一共展示了IConstructionCallMessage类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetPropertiesForNewContext
public virtual void GetPropertiesForNewContext(IConstructionCallMessage ctorMsg)
{
for (int i = 0; i < this._cp.Count; i++)
{
ctorMsg.ContextProperties.Add(this._cp[i]);
}
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:7,代码来源:RemotePropertyHolderAttribute.cs
示例2: GetPropertiesForNewContext
public override void GetPropertiesForNewContext(IConstructionCallMessage ctorMsg)
{
if (ctorMsg.Properties.Contains("Remote"))
{
string remActivatorURL = (string) ctorMsg.Properties["Remote"];
AppDomainLevelActivator activator = new AppDomainLevelActivator(remActivatorURL);
IActivator nextActivator = ctorMsg.Activator;
if (nextActivator.Level < ActivatorLevel.AppDomain)
{
activator.NextActivator = nextActivator;
ctorMsg.Activator = activator;
}
else if (nextActivator.NextActivator != null)
{
while (nextActivator.NextActivator.Level >= ActivatorLevel.AppDomain)
{
nextActivator = nextActivator.NextActivator;
}
activator.NextActivator = nextActivator.NextActivator;
nextActivator.NextActivator = activator;
}
else
{
nextActivator.NextActivator = activator;
}
}
}
示例3: GetPropertiesForNewContext
/// <summary>
/// Adds the current context property to the given message.
/// </summary>
/// <param name="ctorMsg">The <see cref="T:System.Runtime.Remoting.Activation.IConstructionCallMessage"/> to which to add the context property.</param>
/// <exception cref="T:System.ArgumentNullException">
/// The <paramref name="ctorMsg"/> parameter is null.
/// </exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="Infrastructure"/>
/// </PermissionSet>
public override void GetPropertiesForNewContext(IConstructionCallMessage ctorMsg)
{
if (AspectConfiguration.Instance.Enabled)
{
ctorMsg.ContextProperties.Add(new AspectProperty());
}
}
示例4: Activate
public IConstructionReturnMessage Activate (IConstructionCallMessage ctorCall)
{
IConstructionReturnMessage response;
// Create the object by calling the remote activation service
IActivator remoteActivator = (IActivator) RemotingServices.Connect (typeof (IActivator), _activationUrl);
ctorCall.Activator = ctorCall.Activator.NextActivator;
try
{
response = remoteActivator.Activate (ctorCall);
}
catch (Exception ex)
{
return new ConstructionResponse (ex, ctorCall);
}
// Create the client identity for the remote object
ObjRef objRef = (ObjRef) response.ReturnValue;
if (RemotingServices.GetIdentityForUri (objRef.URI) != null)
throw new RemotingException("Inconsistent state during activation; there may be two proxies for the same object");
object proxy;
// We pass null for proxyType because we don't really to attach the identity
// to a proxy, we already have one.
Identity identity = RemotingServices.GetOrCreateClientIdentity (objRef, null, out proxy);
RemotingServices.SetMessageTargetIdentity (ctorCall, identity);
return response;
}
示例5: Activate
internal static IConstructionReturnMessage Activate(RemotingProxy remProxy, IConstructionCallMessage ctorMsg)
{
IConstructionReturnMessage message = null;
if (((ConstructorCallMessage) ctorMsg).ActivateInContext)
{
message = ctorMsg.Activator.Activate(ctorMsg);
if (message.Exception != null)
{
throw message.Exception;
}
return message;
}
GetPropertiesFromAttributes(ctorMsg, ctorMsg.CallSiteActivationAttributes);
GetPropertiesFromAttributes(ctorMsg, ((ConstructorCallMessage) ctorMsg).GetWOMAttributes());
GetPropertiesFromAttributes(ctorMsg, ((ConstructorCallMessage) ctorMsg).GetTypeAttributes());
IMethodReturnMessage message2 = (IMethodReturnMessage) Thread.CurrentContext.GetClientContextChain().SyncProcessMessage(ctorMsg);
message = message2 as IConstructionReturnMessage;
if (message2 == null)
{
throw new RemotingException(Environment.GetResourceString("Remoting_Activation_Failed"));
}
if (message2.Exception != null)
{
throw message2.Exception;
}
return message;
}
示例6: GetPropertiesForNewContext
public void GetPropertiesForNewContext(IConstructionCallMessage ctor)
{
if (_contextProperties != null)
{
foreach (object prop in _contextProperties)
ctor.ContextProperties.Add (prop);
}
}
示例7: GetPropertiesForNewContext
public override void GetPropertiesForNewContext(IConstructionCallMessage ctorMsg)
{
if (ctorMsg == null)
throw new ArgumentNullException("ctorMsg");
IContextProperty cachedProperty = new CachedContextProperty();
ctorMsg.ContextProperties.Add(cachedProperty);
}
示例8: GetPropertiesForNewContext
public override void GetPropertiesForNewContext(IConstructionCallMessage ctorMsg)
{
// We are not interested in contributing any properties to the
// new context since the only purpose of this property is to force
// the creation of the context and the server object inside it at
// the specified URL.
return;
}
示例9: ArgumentNullException
// Get the properties for a new construction context.
public virtual void GetPropertiesForNewContext
(IConstructionCallMessage ctorMsg)
{
if(ctorMsg == null)
{
throw new ArgumentNullException("ctorMsg");
}
ctorMsg.ContextProperties.Add(this);
}
示例10: GetMethodBase
private static MethodBase GetMethodBase(IConstructionCallMessage msg)
{
MethodBase methodBase = msg.MethodBase;
if (null == methodBase)
{
throw new RemotingException(string.Format(CultureInfo.CurrentCulture, Environment.GetResourceString("Remoting_Message_MethodMissing"), new object[] { msg.MethodName, msg.TypeName }));
}
return methodBase;
}
示例11: IsContextOK
public override bool IsContextOK(Context ctx, IConstructionCallMessage ctorMsg)
{
var p = ctx.GetProperty("Reporting") as ReportingProperty;
if (p == null)
{
return false;
}
return true;
}
示例12: 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
}
示例13: RemoteActivate
public static IMessage RemoteActivate (IConstructionCallMessage ctorCall)
{
try
{
return ctorCall.Activator.Activate (ctorCall);
}
catch (Exception ex)
{
return new ReturnMessage (ex, ctorCall);
}
}
示例14: CreateConstructionReturnMessage
public static IConstructionReturnMessage CreateConstructionReturnMessage(IConstructionCallMessage ctorMsg, MarshalByRefObject retObj)
{
IConstructionReturnMessage ctorRetMsg = null;
// Create the return message
ctorRetMsg = new ConstructorReturnMessage(retObj, null, 0, null, ctorMsg);
// NOTE: WE ALLOW ONLY DEFAULT CTORs on SERVICEDCOMPONENTS
return ctorRetMsg;
}
示例15: GetPropertiesForNewContext
public override void GetPropertiesForNewContext(IConstructionCallMessage msg)
{
if (msg == null)
{
throw new ArgumentNullException("msg");
}
msg.ContextProperties.Add(new CoreTestProperty<TestTimerAspect>());
msg.ContextProperties.Add(new CoreTestProperty<TestTransactionAspect>());
msg.ContextProperties.Add(new CoreTestProperty<ExpectedExceptionMessageAspect>());
}