本文整理汇总了C#中IMethodMessage类的典型用法代码示例。如果您正苦于以下问题:C# IMethodMessage类的具体用法?C# IMethodMessage怎么用?C# IMethodMessage使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IMethodMessage类属于命名空间,在下文中一共展示了IMethodMessage类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: IsGetHashCodeMethod
private static bool IsGetHashCodeMethod(IMethodMessage mcm)
{
if (mcm.MethodName != "GetHashCode") return false;
Type[] argTypes = mcm.MethodSignature as Type[];
if (argTypes == null) return false;
return (argTypes.Length == 0);
}
示例2: TryRaisePropertyChanged
private void TryRaisePropertyChanged(IMethodMessage methodMessage)
{
if (methodMessage.MethodName.StartsWith("set_"))
{
var propertyName = methodMessage.MethodName.Substring(4);
var type = Type.GetType(methodMessage.TypeName);
var pi = type.GetProperty(propertyName);
// check that we have the attribute defined
if (Attribute.GetCustomAttribute(pi, typeof(NotifyAttribute)) != null)
{
// get the field storing the delegate list that are stored by the event.
FieldInfo info = type.GetFields(BindingFlags.Instance | BindingFlags.NonPublic)
.Where(f => f.FieldType == typeof(PropertyChangedEventHandler))
.FirstOrDefault();
if (info != null)
{
// get the value of the field
var handler = info.GetValue(_target) as PropertyChangedEventHandler;
// invoke the delegate if it's not null (aka empty)
if (handler != null)
handler.Invoke(_target, new PropertyChangedEventArgs(propertyName));
}
}
}
}
示例3: ProcessEventParameters
private static bool ProcessEventParameters(WorkflowParameterBindingCollection parameters, IMethodMessage message, Type interfaceType, string operation)
{
bool isKnownSignature = false;
if (parameters == null)
return isKnownSignature;
EventInfo eventInfo = interfaceType.GetEvent(operation);
MethodInfo methodInfo = eventInfo.EventHandlerType.GetMethod("Invoke");
int index = 0;
foreach (ParameterInfo formalParameter in methodInfo.GetParameters())
{
if ((typeof(ExternalDataEventArgs).IsAssignableFrom(formalParameter.ParameterType)))
{
if (index == 1)
isKnownSignature = true;
}
if (parameters.Contains(formalParameter.Name))
{
WorkflowParameterBinding binding = parameters[formalParameter.Name];
binding.Value = message.Args[index];
}
index++;
}
return isKnownSignature;
}
示例4: GetMethodName
public static string GetMethodName(IMethodMessage methodMessage)
{
string methodName = methodMessage.MethodName;
switch (methodName)
{
case ".ctor":
{
return "Constructor";
}
case "FieldGetter":
case "FieldSetter":
{
IMethodCallMessage methodCallMessage = (IMethodCallMessage)methodMessage;
return (string)methodCallMessage.InArgs[1];
}
}
if (methodName.EndsWith("Item"))
{
return methodName;
}
if (methodName.StartsWith("get_") || methodName.StartsWith("set_"))
{
return methodName.Substring(4);
}
if (methodName.StartsWith("add_"))
{
return methodName.Substring(4) + "+=";
}
if (methodName.StartsWith("remove_"))
{
return methodName.Substring(7) + "-=";
}
return methodName;
}
示例5: IsEqualsMethod
private static bool IsEqualsMethod(IMethodMessage mcm)
{
if (mcm.MethodName != "Equals") return false;
Type[] argTypes = mcm.MethodSignature as Type[];
if (argTypes == null) return false;
if (argTypes.Length == 1 && argTypes[0] == typeof(object)) return true;
return false;
}
示例6: OnBegin
/// <summary>
/// 开始事务
/// </summary>
/// <param name="attributes"></param>
/// <param name="message"></param>
private static void OnBegin(IEnumerable<object> attributes, IMethodMessage message)
{
foreach (var attr in attributes)
{
if (attr.GetType() == typeof(TransactionAttribute))
{
var tran = attr as TransactionAttribute;
if (tran != null) tran.OnBegin();
}
}
}
示例7: ArgMapper
internal ArgMapper(IMethodMessage mm, bool fOut)
{
this._mm = mm;
MethodBase methodBase = this._mm.MethodBase;
this._methodCachedData = InternalRemotingServices.GetReflectionCachedData(methodBase);
if (fOut)
{
this._map = this._methodCachedData.MarshalResponseArgMap;
}
else
{
this._map = this._methodCachedData.MarshalRequestArgMap;
}
}
示例8: CreateRequest
RequestMessage CreateRequest(IMethodMessage methodCall)
{
var activityId = Guid.NewGuid();
var method = ((MethodInfo) methodCall.MethodBase);
var request = new RequestMessage
{
Id = contractType.Name + "::" + method.Name + "[" + Interlocked.Increment(ref callId) + "] / " + activityId,
ActivityId = activityId,
Destination = endPoint,
MethodName = method.Name,
ServiceName = contractType.Name,
Params = methodCall.Args
};
return request;
}
示例9: ProcessEventParameters
private static bool ProcessEventParameters(WorkflowParameterBindingCollection parameters, IMethodMessage message, Type interfaceType, string operation)
{
bool flag = false;
if (parameters != null)
{
MethodInfo method = interfaceType.GetEvent(operation).EventHandlerType.GetMethod("Invoke");
int index = 0;
foreach (ParameterInfo info3 in method.GetParameters())
{
if (typeof(ExternalDataEventArgs).IsAssignableFrom(info3.ParameterType) && (index == 1))
{
flag = true;
}
if (parameters.Contains(info3.Name))
{
WorkflowParameterBinding binding = parameters[info3.Name];
binding.Value = message.Args[index];
}
index++;
}
}
return flag;
}
示例10: CADMessageBase
public CADMessageBase (IMethodMessage msg) {
CADMethodRef methodRef = new CADMethodRef (msg);
serializedMethod = CADSerializer.SerializeObject (methodRef).GetBuffer ();
}
示例11: SaveLogicalCallContext
protected void SaveLogicalCallContext (IMethodMessage msg, ref ArrayList serializeList)
{
if (msg.LogicalCallContext != null && msg.LogicalCallContext.HasInfo)
{
if (serializeList == null)
serializeList = new ArrayList();
_callContext = new CADArgHolder (serializeList.Count);
serializeList.Add (msg.LogicalCallContext);
}
}
示例12: GetMethodBase
[System.Security.SecurityCritical] // auto-generated
private static MethodBase GetMethodBase(IMethodMessage msg)
{
MethodBase mb = msg.MethodBase;
if(null == mb)
{
BCLDebug.Trace("REMOTE", "Method missing w/name ", msg.MethodName);
throw new RemotingException(
String.Format(
CultureInfo.CurrentCulture, Environment.GetResourceString(
"Remoting_Message_MethodMissing"),
msg.MethodName,
msg.TypeName));
}
return mb;
}
示例13: GetSessionIdForMethodMessage
[System.Security.SecurityCritical] // auto-generated_required
public static String GetSessionIdForMethodMessage(IMethodMessage msg)
{
return msg.Uri;
} // GetSessionIdForMessage
示例14: IsMethodOverloaded
[System.Security.SecurityCritical] // auto-generated_required
public static bool IsMethodOverloaded(IMethodMessage msg)
{
RemotingMethodCachedData cache =
InternalRemotingServices.GetReflectionCachedData(msg.MethodBase);
return cache.IsOverloaded();
} // IsMethodOverloaded
示例15: GetMethodBaseFromMethodMessage
[System.Security.SecurityCritical] // auto-generated_required
public static MethodBase GetMethodBaseFromMethodMessage(IMethodMessage msg)
{
MethodBase mb = InternalGetMethodBaseFromMethodMessage(msg);
return mb;
}