Skip to content

Archive low page view WF sample topics #7895

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Sep 26, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
362 changes: 361 additions & 1 deletion .openpublishing.redirection.json

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ Receive approveExpense = new Receive

Click the **Add new type** link and use the drop down to select or search for a type to add to the known types collection. To specify known types in code use the <xref:System.ServiceModel.Activities.Receive.KnownTypes%2A> property as shown in the following example.

```
```csharp
Receive approveExpense = new Receive
{
OperationName = "ApproveExpense",
Expand All @@ -42,6 +42,4 @@ Receive approveExpense = new Receive
};
approveExpense.KnownTypes.Add(typeof(Travel));
approveExpense.KnownTypes.Add(typeof(Meal));
```

To see a complete code example showing how to configure serialization for a workflow service see [Formatting messages in Workflow Services](../../../../docs/framework/windows-workflow-foundation/samples/formatting-messages-in-workflow-services.md).
```
13 changes: 6 additions & 7 deletions docs/framework/wcf/feature-details/correlation-overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,12 @@ Correlation is the mechanism for relating workflow service messages to each othe
## Protocol-Based Correlation
Protocol-based correlation uses the transport mechanism to relate messages to each other and the appropriate instance. Some system-provided protocol correlations include request-reply correlation and context-based correlation. A request-reply correlation is used to correlate a single pair of messaging activities to form a two-way operation, such as a <xref:System.ServiceModel.Activities.Send> paired with a <xref:System.ServiceModel.Activities.ReceiveReply>, or a <xref:System.ServiceModel.Activities.Receive> paired with a <xref:System.ServiceModel.Activities.SendReply>. The [!INCLUDE[vs_current_long](../../../../includes/vs-current-long-md.md)] Workflow Designer also provides a set of activity templates to quickly implement this pattern. A context-based correlation is based on the context exchange mechanism described in the [.NET Context Exchange Protocol Specification](https://go.microsoft.com/fwlink/?LinkID=166059). To use context-based correlation, a context-based binding such as <xref:System.ServiceModel.BasicHttpContextBinding>, <xref:System.ServiceModel.WSHttpContextBinding> or <xref:System.ServiceModel.NetTcpContextBinding> must be used on the endpoint.

For more information about protocol correlation, see [Durable Duplex](../../../../docs/framework/wcf/feature-details/durable-duplex-correlation.md), and [Request-Reply](../../../../docs/framework/wcf/feature-details/request-reply-correlation.md). For more information about using the [!INCLUDE[vs_current_long](../../../../includes/vs-current-long-md.md)] Workflow Designer activity templates, see [Messaging Activities](../../../../docs/framework/wcf/feature-details/messaging-activities.md). For sample code, see the [Durable Duplex &#91;WF Samples&#93;](../../../../docs/framework/windows-workflow-foundation/samples/durable-duplex.md) and [NetContextExchangeCorrelation](https://msdn.microsoft.com/library/93c74a1a-b9e2-46c6-95c0-c9b0e9472caf) samples.
For more information about protocol correlation, see [Durable Duplex](../../../../docs/framework/wcf/feature-details/durable-duplex-correlation.md) and [Request-Reply](../../../../docs/framework/wcf/feature-details/request-reply-correlation.md). For more information about using the [!INCLUDE[vs_current_long](../../../../includes/vs-current-long-md.md)] Workflow Designer activity templates, see [Messaging Activities](../../../../docs/framework/wcf/feature-details/messaging-activities.md). For sample code, see the [NetContextExchangeCorrelation](https://msdn.microsoft.com/library/93c74a1a-b9e2-46c6-95c0-c9b0e9472caf) sample.

## Content-Based Correlation
Content-based correlation uses some piece of information in the message to associate it to a particular instance. Unlike protocol-based correlation, content-based correlation requires the application author to explicitly state where this data can be found in each related message. Activities that use content-based correlation specify this message data by using a <xref:System.ServiceModel.MessageQuerySet>. Content-based correlation is useful when communicating with services that do not use one of the context bindings such as <xref:System.ServiceModel.BasicHttpContextBinding>. For sample code, see the [Content-Based Correlation](../../../../docs/framework/windows-workflow-foundation/samples/content-based-correlation.md) and [Correlated Calculator](../../../../docs/framework/windows-workflow-foundation/samples/correlated-calculator.md) samples.
## Content-Based Correlation

Content-based correlation uses some piece of information in the message to associate it to a particular instance. Unlike protocol-based correlation, content-based correlation requires the application author to explicitly state where this data can be found in each related message. Activities that use content-based correlation specify this message data by using a <xref:System.ServiceModel.MessageQuerySet>. Content-based correlation is useful when communicating with services that do not use one of the context bindings such as <xref:System.ServiceModel.BasicHttpContextBinding>.

## See Also
[Content-Based Correlation](../../../../docs/framework/windows-workflow-foundation/samples/content-based-correlation.md)
[Correlated Calculator](../../../../docs/framework/windows-workflow-foundation/samples/correlated-calculator.md)
[Durable Duplex &#91;WF Samples&#93;](../../../../docs/framework/windows-workflow-foundation/samples/durable-duplex.md)
[NetContextExchangeCorrelation](https://msdn.microsoft.com/library/93c74a1a-b9e2-46c6-95c0-c9b0e9472caf)

- [NetContextExchangeCorrelation](https://msdn.microsoft.com/library/93c74a1a-b9e2-46c6-95c0-c9b0e9472caf)
11 changes: 5 additions & 6 deletions docs/framework/wcf/feature-details/correlation.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,8 @@ When workflow service applications communicate with other services, it is import
Provides methods for troubleshooting correlation.

## See Also
<xref:System.ServiceModel.Activities.CorrelationHandle>
<xref:System.ServiceModel.Activities.Send>
<xref:System.ServiceModel.Activities.Receive>
<xref:System.ServiceModel.CorrelationQuery>
[Content-Based Correlation](../../../../docs/framework/windows-workflow-foundation/samples/content-based-correlation.md)
[Correlated Calculator](../../../../docs/framework/windows-workflow-foundation/samples/correlated-calculator.md)

- <xref:System.ServiceModel.Activities.CorrelationHandle>
- <xref:System.ServiceModel.Activities.Send>
- <xref:System.ServiceModel.Activities.Receive>
- <xref:System.ServiceModel.CorrelationQuery>
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,4 @@ WF2 - Items sent
WF1 - Items Received
```

In this example, both workflows explicitly manage correlation using a <xref:System.ServiceModel.Activities.CallbackCorrelationInitializer>. Because there was only a single correlation in these sample workflows, the default <xref:System.ServiceModel.Activities.CorrelationHandle> management would have been sufficient.

## See Also
[Durable Duplex &#91;WF Samples&#93;](../../../../docs/framework/windows-workflow-foundation/samples/durable-duplex.md)
In this example, both workflows explicitly manage correlation using a <xref:System.ServiceModel.Activities.CallbackCorrelationInitializer>. Because there was only a single correlation in these sample workflows, the default <xref:System.ServiceModel.Activities.CorrelationHandle> management would have been sufficient.
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,6 @@ Workflow services and clients can participate in transactions. For a service op
```

## See Also
[Workflow Services](../../../../docs/framework/wcf/feature-details/workflow-services.md)
[Windows Communication Foundation Transactions Overview](../../../../docs/framework/wcf/feature-details/transactions-overview.md)
[Use of TransactedReceiveScope](../../../../docs/framework/windows-workflow-foundation/samples/use-of-transactedreceivescope.md)

- [Workflow Services](../../../../docs/framework/wcf/feature-details/workflow-services.md)
- [Windows Communication Foundation Transactions Overview](../../../../docs/framework/wcf/feature-details/transactions-overview.md)
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ class CustomFactory : WorkflowServiceHostFactory
host.WorkflowExtensions.Add(new ConsoleTrackingParticipant());
```

A tracking participant such as the ConsoleTrackingParticipant is useful for self-hosted workflow services that have a console window. For a Web-hosted service, a tracking participant that logs the tracking information to a durable store should be used, such as the built-in <xref:System.Activities.Tracking.EtwTrackingParticipant>, or a custom tracking participant that logs the information to a file, such as the `TextWriterTrackingParticpant` from the [Tracking Using a Text File](../../../../docs/framework/windows-workflow-foundation/samples/tracking-using-a-text-file.md) sample.
A tracking participant such as the ConsoleTrackingParticipant is useful for self-hosted workflow services that have a console window. For a Web-hosted service, a tracking participant that logs the tracking information to a durable store should be used, such as the built-in <xref:System.Activities.Tracking.EtwTrackingParticipant>, or a custom tracking participant that logs the information to a file.

For more information about tracking and configuring tracking for a Web-hosted workflow service, see [Workflow Tracking and Tracing](../../../../docs/framework/windows-workflow-foundation/workflow-tracking-and-tracing.md), [Configuring Tracking for a Workflow](../../../../docs/framework/windows-workflow-foundation/configuring-tracking-for-a-workflow.md), and the [Tracking &#91;WF Samples&#93;](../../../../docs/framework/windows-workflow-foundation/samples/tracking.md) samples.

Expand Down Expand Up @@ -208,7 +208,7 @@ sm:body()/xg0:AddItemMessage/xg0:CartId
sm:header()/tempuri:CartId
```

This can be confirmed by examining the body of the message.
This can be confirmed by examining the body of the message.

```xml
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
Expand All @@ -224,7 +224,7 @@ sm:header()/tempuri:CartId
</s:Envelope>
```

The following example shows a <xref:System.ServiceModel.Activities.Receive> activity configured for an `AddItem` operation that uses the previous message contract to receive data. The XPath query is correctly configured.
The following example shows a <xref:System.ServiceModel.Activities.Receive> activity configured for an `AddItem` operation that uses the previous message contract to receive data. The XPath query is correctly configured.

```xaml
<Receive CorrelatesWith="[CCHandle] OperationName="AddItem" ServiceContractName="p:IService">
Expand All @@ -240,6 +240,4 @@ sm:header()/tempuri:CartId
<p1:OutArgument x:TypeArguments="m:AddItemMessage">[AddItemMessage]</p1:OutArgument>
</ReceiveMessageContent>
</Receive>
```

For more information about content-based correlation, see the [Correlated Calculator](../../../../docs/framework/windows-workflow-foundation/samples/correlated-calculator.md) sample.
```
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ ms.assetid: af44596f-bf6a-4149-9f04-08d8e8f45250

![WorkflowServiceHost Overview](../../../../docs/framework/wcf/feature-details/media/wfshhighlevel.gif "WFSHHighLevel")

This diagram shows that <xref:System.ServiceModel.WorkflowServiceHost> loads workflow service definitions from .xamlx files and loads configuration information from a configuration file. It also loads tracking configuration from the tracking profile. <xref:System.ServiceModel.WorkflowServiceHost> exposes a workflow control endpoint which allows you to send control operations to workflow instances. For more information see [Workflow Control Endpoint](../../../../docs/framework/wcf/feature-details/workflow-control-endpoint.md) and [Workflow Management Endpoint Sample](../../../../docs/framework/windows-workflow-foundation/samples/workflow-management-endpoint-sample.md).
This diagram shows that <xref:System.ServiceModel.WorkflowServiceHost> loads workflow service definitions from .xamlx files and loads configuration information from a configuration file. It also loads tracking configuration from the tracking profile. <xref:System.ServiceModel.WorkflowServiceHost> exposes a workflow control endpoint which allows you to send control operations to workflow instances. For more information see [Workflow Control Endpoint sample](../../../../docs/framework/wcf/feature-details/workflow-control-endpoint.md).

<xref:System.ServiceModel.WorkflowServiceHost> also exposes application endpoints that listen for incoming application messages. When an incoming message arrives it is sent to the appropriate workflow service instance (if it is currently loaded). If needed a new workflow instance is created. Or if an existing instance has been persisted it is loaded from the persistence store.

Expand Down Expand Up @@ -41,13 +41,13 @@ ms.assetid: af44596f-bf6a-4149-9f04-08d8e8f45250
The message arrives and is processed by the WCF channel stack. Throttles are checked and correlation queries are executed. The message is bound for an existing instance (because CanCreateInstance is false) so the instance is loaded from persistence store, the bookmark is resumed and the workflow executes.

> [!WARNING]
> Workflow Service Host will fail to open if SQL Server is configured to listen on NamedPipe protocol only.

## See Also
[Workflow Services](../../../../docs/framework/wcf/feature-details/workflow-services.md)
[Hosting Workflow Services](../../../../docs/framework/wcf/feature-details/hosting-workflow-services.md)
[Workflow Control Endpoint](../../../../docs/framework/wcf/feature-details/workflow-control-endpoint.md)
[Workflow Management Endpoint Sample](../../../../docs/framework/windows-workflow-foundation/samples/workflow-management-endpoint-sample.md)
[How to: Configure Workflow Unhandled Exception Behavior with WorkflowServiceHost](../../../../docs/framework/wcf/feature-details/config-workflow-unhandled-exception-workflowservicehost.md)
[Creating a Long-running Workflow Service](../../../../docs/framework/wcf/feature-details/creating-a-long-running-workflow-service.md)
[Workflow Persistence](../../../../docs/framework/windows-workflow-foundation/workflow-persistence.md)
> Workflow Service Host will fail to open if SQL Server is configured to listen on NamedPipe protocol only.

## See Also

- [Workflow Services](../../../../docs/framework/wcf/feature-details/workflow-services.md)
- [Hosting Workflow Services](../../../../docs/framework/wcf/feature-details/hosting-workflow-services.md)
- [Workflow Control Endpoint](../../../../docs/framework/wcf/feature-details/workflow-control-endpoint.md)
- [How to: Configure Workflow Unhandled Exception Behavior with WorkflowServiceHost](../../../../docs/framework/wcf/feature-details/config-workflow-unhandled-exception-workflowservicehost.md)
- [Creating a Long-running Workflow Service](../../../../docs/framework/wcf/feature-details/creating-a-long-running-workflow-service.md)
- [Workflow Persistence](../../../../docs/framework/windows-workflow-foundation/workflow-persistence.md)
22 changes: 12 additions & 10 deletions docs/framework/windows-workflow-foundation/compensation.md
Original file line number Diff line number Diff line change
Expand Up @@ -305,20 +305,22 @@ Activity wf = new Sequence()
</Sequence>
```

When the workflow is invoked, the following output is displayed to the console.
When the workflow is invoked, the following output is displayed to the console.

**ReserveFlight: Ticket is reserved.**
**ReserveFlight: Ticket is reserved.**
**ManagerApproval: Manager approval received.**
**PurchaseFlight: Ticket is purchased.**
**TakeFlight: Flight is completed.**
**ConfirmFlight: Flight has been taken, no compensation possible.**
**Workflow completed successfully with status: Closed.**

## Nesting Compensation Activities
A <xref:System.Activities.Statements.CompensableActivity> can be placed into the <xref:System.Activities.Statements.CompensableActivity.Body%2A> section of another <xref:System.Activities.Statements.CompensableActivity>. A <xref:System.Activities.Statements.CompensableActivity> may not be placed into a handler of another <xref:System.Activities.Statements.CompensableActivity>. It is the responsibility of a parent <xref:System.Activities.Statements.CompensableActivity> to ensure that when it is canceled, confirmed, or compensated, all child compensable activities that have completed successfully and have not already been confirmed or compensated must be confirmed or compensated before the parent completes cancellation, confirmation, or compensation. If this is not modeled explicitly the parent <xref:System.Activities.Statements.CompensableActivity> will implicitly compensate child compensable activities if the parent received the cancel or compensate signal. If the parent received the confirm signal the parent will implicitly confirm child compensable activities. If the logic to handle cancellation, confirmation, or compensation is explicitly modeled in the handler of the parent <xref:System.Activities.Statements.CompensableActivity>, any child not explicitly handled will be implicitly confirmed.

## See Also
<xref:System.Activities.Statements.CompensableActivity>
<xref:System.Activities.Statements.Compensate>
<xref:System.Activities.Statements.Confirm>
<xref:System.Activities.Statements.CompensationToken>
[Compensable Activity](../../../docs/framework/windows-workflow-foundation/samples/compensable-activity-sample.md)

A <xref:System.Activities.Statements.CompensableActivity> can be placed into the <xref:System.Activities.Statements.CompensableActivity.Body%2A> section of another <xref:System.Activities.Statements.CompensableActivity>. A <xref:System.Activities.Statements.CompensableActivity> may not be placed into a handler of another <xref:System.Activities.Statements.CompensableActivity>. It is the responsibility of a parent <xref:System.Activities.Statements.CompensableActivity> to ensure that when it is canceled, confirmed, or compensated, all child compensable activities that have completed successfully and have not already been confirmed or compensated must be confirmed or compensated before the parent completes cancellation, confirmation, or compensation. If this is not modeled explicitly the parent <xref:System.Activities.Statements.CompensableActivity> will implicitly compensate child compensable activities if the parent received the cancel or compensate signal. If the parent received the confirm signal the parent will implicitly confirm child compensable activities. If the logic to handle cancellation, confirmation, or compensation is explicitly modeled in the handler of the parent <xref:System.Activities.Statements.CompensableActivity>, any child not explicitly handled will be implicitly confirmed.

## See Also

- <xref:System.Activities.Statements.CompensableActivity>
- <xref:System.Activities.Statements.Compensate>
- <xref:System.Activities.Statements.Confirm>
- <xref:System.Activities.Statements.CompensationToken>
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,6 @@ ms.assetid: 1af85cc6-912d-449e-90c5-c5db3eca5ace

8. Right-click the Workflow1.xaml file in the **Solution Explorer** and select **View Code**. Note that the activity class is created with `x:Class` and the property is created with `x:Property`.

## See Also
[Authoring Workflows, Activities, and Expressions Using Imperative Code](../../../docs/framework/windows-workflow-foundation/authoring-workflows-activities-and-expressions-using-imperative-code.md)
[DynamicActivity Creation](../../../docs/framework/windows-workflow-foundation/samples/dynamicactivity-creation.md)
## See Also

- [Authoring Workflows, Activities, and Expressions Using Imperative Code](../../../docs/framework/windows-workflow-foundation/authoring-workflows-activities-and-expressions-using-imperative-code.md)
Loading