static SendReplyDesigner() { AttributeTableBuilder builder = new AttributeTableBuilder(); Type sendType = typeof(SendReply); builder.AddCustomAttributes(sendType, sendType.GetProperty("CorrelationInitializers"), PropertyValueEditor.CreateEditorAttribute(typeof(CorrelationInitializerValueEditor))); var categoryAttribute = new CategoryAttribute(EditorCategoryTemplateDictionary.Instance.GetCategoryTitle(CorrelationsCategoryLabelKey)); builder.AddCustomAttributes(sendType, sendType.GetProperty("CorrelationInitializers"), categoryAttribute, BrowsableAttribute.Yes, PropertyValueEditor.CreateEditorAttribute(typeof(CorrelationInitializerValueEditor))); categoryAttribute = new CategoryAttribute(EditorCategoryTemplateDictionary.Instance.GetCategoryTitle(MiscellaneousCategoryLabelKey)); builder.AddCustomAttributes(sendType, sendType.GetProperty("DisplayName"), categoryAttribute); var descriptionAttribute = new DescriptionAttribute(StringResourceDictionary.Instance.GetString("messagingValueHint", "<Value to bind>")); builder.AddCustomAttributes(sendType, sendType.GetProperty("Content"), categoryAttribute, descriptionAttribute, PropertyValueEditor.CreateEditorAttribute(typeof(SendContentPropertyEditor))); builder.AddCustomAttributes(sendType, sendType.GetProperty("Request"), categoryAttribute, PropertyValueEditor.CreateEditorAttribute(typeof(ActivityXRefPropertyEditor))); var advancedAttribute = new EditorBrowsableAttribute(EditorBrowsableState.Advanced); builder.AddCustomAttributes(sendType, sendType.GetProperty("Action"), categoryAttribute, advancedAttribute); Action = sendType.GetProperty("Action").Name; Type sendMessageContentType = typeof(SendMessageContent); Message = sendMessageContentType.GetProperty("Message").Name; DeclaredMessageType = sendMessageContentType.GetProperty("DeclaredMessageType").Name; MetadataStore.AddAttributeTable(builder.CreateTable()); Func <Activity, IEnumerable <ArgumentAccessor> > argumentAccessorGenerator = (activity) => new ArgumentAccessor[] { new ArgumentAccessor { Getter = (ownerActivity) => { SendReply sendReply = (SendReply)ownerActivity; SendMessageContent content = sendReply.Content as SendMessageContent; return(content != null ? content.Message : null); }, Setter = (ownerActivity, arg) => { SendReply sendReply = (SendReply)ownerActivity; SendMessageContent content = sendReply.Content as SendMessageContent; if (content != null) { content.Message = arg as InArgument; } }, }, }; ActivityArgumentHelper.RegisterAccessorsGenerator(sendType, argumentAccessorGenerator); }
void OnModelItemPropertyChanged(object sender, PropertyChangedEventArgs e) { if (string.Equals(e.PropertyName, Message)) { SendMessageContent messageContent = ((Send)this.ModelItem.GetCurrentValue()).Content as SendMessageContent; this.ModelItem.Properties[DeclaredMessageType].SetValue(null == messageContent ? null : messageContent.Message.ArgumentType); } }
public override IList <string> Convert(object value) { List <string> results = new List <string>(); SendMessageContent content = value as SendMessageContent; if (null != content) { results.AddRange(new ArgumentSearchableStringConverter().Convert(content.Message)); results.AddRange(new TypeSearchableStringConverter().Convert(content.DeclaredMessageType)); } return(results); }
private Activity InternalImplementation() { string correlationKey = Guid.NewGuid().ToString(); Send sendBootstrap = new Send { OperationName = "Bootstrap", EndpointConfigurationName = endpointConfigurationName, Content = SendMessageContent.Create(new InArgument <string>(correlationKey)), ServiceContractName = Constants.ServiceContractName, }; // In this sample there is no client side transaction, so transaction flow is not occuring. // Instead the service workflow is creating and scoping the transaction. return(new CorrelationScope() { Body = new Sequence { Activities = { new WriteLine { Text = "Client: Workflow begins." }, new WriteLine { Text = "Client: Bootstrap service." }, // The service requires an initial Request represented by this "bootstrap" message. sendBootstrap, new ReceiveReply { Request = sendBootstrap }, new WriteLine { Text = "Client: Beginning parallel sends." }, // The service workflow is now in a state where it's accepting multiple requests in parallel. // All of these requests will execute under the same server side transaction. new Parallel() { CompletionCondition = false, Branches = { new Send { OperationName = "WorkBranch1", ServiceContractName = Constants.ServiceContractName, EndpointConfigurationName = endpointConfigurationName, Content = SendMessageContent.Create(new InArgument <string>(correlationKey)) }, new Send { OperationName = "WorkBranch2", ServiceContractName = Constants.ServiceContractName, EndpointConfigurationName = endpointConfigurationName, Content = SendMessageContent.Create(new InArgument <string>(correlationKey)), }, new Send { OperationName = "WorkBranch3", ServiceContractName = Constants.ServiceContractName, EndpointConfigurationName = endpointConfigurationName, Content = SendMessageContent.Create(new InArgument <string>(correlationKey)), }, }, }, new WriteLine { Text = "Client: All sends complete." }, new WriteLine { Text = "Client: Workflow ends." } } } }); }
static SendDesigner() { AttributeTableBuilder builder = new AttributeTableBuilder(); Type sendType = typeof(Send); builder.AddCustomAttributes(sendType, sendType.GetProperty("CorrelationInitializers"), PropertyValueEditor.CreateEditorAttribute(typeof(CorrelationInitializerValueEditor))); var categoryAttribute = new CategoryAttribute(EditorCategoryTemplateDictionary.Instance.GetCategoryTitle(CorrelationsCategoryLabelKey)); var descriptionAttribute = new DescriptionAttribute(StringResourceDictionary.Instance.GetString("messagingCorrelatesWithHint", "Correlation handle")); builder.AddCustomAttributes(sendType, sendType.GetProperty("CorrelatesWith"), categoryAttribute, descriptionAttribute); builder.AddCustomAttributes(sendType, sendType.GetProperty("CorrelationInitializers"), categoryAttribute, BrowsableAttribute.Yes, PropertyValueEditor.CreateEditorAttribute(typeof(CorrelationInitializerValueEditor))); categoryAttribute = new CategoryAttribute(EditorCategoryTemplateDictionary.Instance.GetCategoryTitle(EndpointCategoryLabelKey)); builder.AddCustomAttributes(sendType, sendType.GetProperty("Endpoint"), categoryAttribute, new TypeConverterAttribute(typeof(ExpandableObjectConverter))); descriptionAttribute = new DescriptionAttribute(StringResourceDictionary.Instance.GetString("messagingEndpointAddressHint", "<Address>")); builder.AddCustomAttributes(sendType, sendType.GetProperty("EndpointAddress"), categoryAttribute, descriptionAttribute); builder.AddCustomAttributes(sendType, sendType.GetProperty("EndpointConfigurationName"), categoryAttribute); categoryAttribute = new CategoryAttribute(EditorCategoryTemplateDictionary.Instance.GetCategoryTitle(MiscellaneousCategoryLabelKey)); builder.AddCustomAttributes(sendType, sendType.GetProperty("DisplayName"), categoryAttribute); builder.AddCustomAttributes(sendType, sendType.GetProperty("OperationName"), categoryAttribute); builder.AddCustomAttributes(sendType, sendType.GetProperty("ServiceContractName"), categoryAttribute, new TypeConverterAttribute(typeof(XNameConverter))); descriptionAttribute = new DescriptionAttribute(StringResourceDictionary.Instance.GetString("messagingValueHint", "<Value to bind>")); builder.AddCustomAttributes(sendType, sendType.GetProperty("Content"), categoryAttribute, descriptionAttribute, PropertyValueEditor.CreateEditorAttribute(typeof(SendContentPropertyEditor))); var advancedAttribute = new EditorBrowsableAttribute(EditorBrowsableState.Advanced); builder.AddCustomAttributes(sendType, sendType.GetProperty("Action"), advancedAttribute, categoryAttribute); builder.AddCustomAttributes( sendType, "KnownTypes", advancedAttribute, categoryAttribute, PropertyValueEditor.CreateEditorAttribute(typeof(TypeCollectionPropertyEditor)), new EditorOptionAttribute { Name = TypeCollectionPropertyEditor.AllowDuplicate, Value = false }); builder.AddCustomAttributes(sendType, sendType.GetProperty("ProtectionLevel"), advancedAttribute, categoryAttribute); builder.AddCustomAttributes(sendType, sendType.GetProperty("SerializerOption"), advancedAttribute, categoryAttribute); builder.AddCustomAttributes(sendType, sendType.GetProperty("TokenImpersonationLevel"), advancedAttribute, categoryAttribute); Action = sendType.GetProperty("Action").Name; Type sendMessageContentType = typeof(SendMessageContent); Message = sendMessageContentType.GetProperty("Message").Name; DeclaredMessageType = sendMessageContentType.GetProperty("DeclaredMessageType").Name; MetadataStore.AddAttributeTable(builder.CreateTable()); Func <Activity, IEnumerable <ArgumentAccessor> > argumentAccessorGenerator = (activity) => new ArgumentAccessor[] { new ArgumentAccessor { Getter = (ownerActivity) => { Send send = (Send)ownerActivity; SendMessageContent content = send.Content as SendMessageContent; return(content != null ? content.Message : null); }, Setter = (ownerActivity, arg) => { Send send = (Send)ownerActivity; SendMessageContent content = send.Content as SendMessageContent; if (content != null) { content.Message = arg as InArgument; } }, }, }; ActivityArgumentHelper.RegisterAccessorsGenerator(sendType, argumentAccessorGenerator); }