MethodInfo InternalGetMethodInfo(IServiceProvider provider, Type contractType) { MethodInfo methodInfo = null; if (contractType != null && ServiceOperationHelpers.IsValidServiceContract(contractType)) { foreach (MethodInfo currentMethodInfo in contractType.GetMethods()) { object[] operationContractAttribs = currentMethodInfo.GetCustomAttributes(typeof(OperationContractAttribute), true); if (operationContractAttribs != null && operationContractAttribs.Length > 0) { string operationName = null; if (operationContractAttribs[0] is OperationContractAttribute) { OperationContractAttribute operationContractAttribute = operationContractAttribs[0] as OperationContractAttribute; operationName = operationContractAttribute.Name; } if (operationContractAttribs[0] is AttributeInfoAttribute) { AttributeInfoAttribute attribInfoAttrib = operationContractAttribs[0] as AttributeInfoAttribute; operationName = GetAttributePropertyValue <string>(provider, attribInfoAttrib.AttributeInfo, "Name"); } if (string.IsNullOrEmpty(operationName) && string.Compare(currentMethodInfo.Name, this.Name, StringComparison.Ordinal) == 0) { methodInfo = currentMethodInfo; break; } else if (string.Compare(operationName, this.Name, StringComparison.Ordinal) == 0) { methodInfo = currentMethodInfo; break; } } } } if (methodInfo == null) { foreach (Type parentContract in contractType.GetInterfaces()) { methodInfo = this.InternalGetMethodInfo(provider, parentContract); if (methodInfo != null) { break; } } } return(methodInfo); }
public override bool IsDefined(Type attributeType, bool inherit) { if (attributeType == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("attributeType"); } return(ServiceOperationHelpers.IsDefined(attributeType, attributes)); }
public override object[] GetCustomAttributes(Type attributeType, bool inherit) { if (attributeType == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("attributeType"); } return(ServiceOperationHelpers.GetCustomAttributes(attributeType, this.attributes)); }
protected override void OnMouseDoubleClick(System.Windows.Forms.MouseEventArgs e) { // Do not allow editing if activity is locked if (this.IsLocked) { return; } OperationInfoBase pickedServiceOperation = null; if (ServiceOperationUIEditor.TryPickOperation(this.Activity.Site, this.Activity, this.SendActivity.ServiceOperationInfo, out pickedServiceOperation)) { PropertyDescriptorUtils.SetPropertyValue(this.Activity.Site, ServiceOperationHelpers.GetServiceOperationInfoPropertyDescriptor(this.Activity), this.Activity, pickedServiceOperation); } }
internal protected override MethodInfo GetMethodInfo(IServiceProvider provider) { if (string.IsNullOrEmpty(this.Name)) { return(null); } MethodInfo methodInfo = null; if (this.IsReadOnly) { if (this.UserData.Contains(OperationInfoBase.MethodInfoProperty)) { methodInfo = this.UserData[OperationInfoBase.MethodInfoProperty] as MethodInfo; } if (methodInfo != null) { return(methodInfo); } } Type type = this.GetContractType(provider); if (type != null && ServiceOperationHelpers.IsValidServiceContract(type)) { methodInfo = this.InternalGetMethodInfo(provider, type); } if (this.IsReadOnly) { this.UserData[OperationInfoBase.MethodInfoProperty] = methodInfo; } return(methodInfo); }