private void UpdateImplementingActivities() { ServiceOperationListItem operationListItem = this.Item as ServiceOperationListItem; WorkflowServiceOperationListItem workflowOperationListItem = this.Item as WorkflowServiceOperationListItem; TypedServiceOperationListItem reflectedOperationListItem = this.Item as TypedServiceOperationListItem; OperationInfoBase operation = null; if (workflowOperationListItem != null) { operation = workflowOperationListItem.Operation; } else if (reflectedOperationListItem != null) { operation = reflectedOperationListItem.Operation; } Fx.Assert(operation != null, "operation should not be null at this point"); // workflow operations list item will complain if some operationInfo objects have different signature than others // for the same operation name. This will happen when we are updating the activities, since they already have a operation // object for that operation name, but with a different signature. so make them all point to null first ,then update. if (workflowOperationListItem != null) { foreach (Activity activity in operationListItem.ImplementingActivities) { PropertyDescriptorUtils.SetPropertyValue(this.ServiceProvider, ServiceOperationHelpers.GetServiceOperationInfoPropertyDescriptor(activity), activity, null); } } foreach (Activity activity in operationListItem.ImplementingActivities) { PropertyDescriptorUtils.SetPropertyValue(this.ServiceProvider, ServiceOperationHelpers.GetServiceOperationInfoPropertyDescriptor(activity), activity, operation.Clone()); } }
private void UpdateImplementingActivities(ServiceContractListItem listItem) { foreach (WorkflowServiceOperationListItem workflowOperationListItem in listItem.Operations) { Fx.Assert(workflowOperationListItem != null, "Operations inside an editable contract should only be workflow first operations"); workflowOperationListItem.Operation.ContractName = listItem.Name; // update the activities implementing the operation too foreach (Activity activity in workflowOperationListItem.ImplementingActivities) { PropertyDescriptorUtils.SetPropertyValue(this.ServiceProvider, ServiceOperationHelpers.GetServiceOperationInfoPropertyDescriptor(activity), activity, workflowOperationListItem.Operation.Clone()); } } }
private void ImportContract(Type serviceContractType) { foreach (MethodInfo methodInfo in GetMethodsFromInterface(serviceContractType)) { if (!ServiceOperationHelpers.IsValidServiceOperation(methodInfo)) { continue; } TypedServiceOperationListItem operationItem = new TypedServiceOperationListItem(); operationItem.Validating += new CancelEventHandler(ServiceOperationValidating); operationItem.Name = ServiceOperationHelpers.GetOperationName(this.serviceProvider, methodInfo); operationItem.Operation.ContractType = serviceContractType; operationItem.Operation.Name = ServiceOperationHelpers.GetOperationName(this.serviceProvider, methodInfo); this.AddServiceOperation(operationItem); } }