<commonParameters>

Represents a collection of parameters that are used globally across multiple services. This collection will typically include the database connection string that might be shared by durable services.

<configuration>
  <system.serviceModel>
    <behaviors>
      <serviceBehaviors>
        <behavior>
          <workflowRuntime>
            <commonParameters>

Syntax

<workflowRuntime>
  <commonParameters>
    <add name="String"
         value="String" />
  </commonParameters>
</workflowRuntime>

Attributes and Elements

The following sections describe attributes, child elements, and parent elements.

Attributes

None.

Child Elements

Element Description
<add> Adds a name-value pair of common parameters used by services to the collection.

Parent Elements

Element Description
<workflowRuntime> Specifies settings for an instance of WorkflowRuntime for hosting workflow-based Windows Communication Foundation (WCF) services.

Remarks

The <commonParameters> element defines any parameters that are used globally across multiple services, for example ConnectionString when using the SharedConnectionWorkflowCommitWorkBatchService.

Note

SQL Tracking service does not consistently use the ConnectionString value if it is specified in the <commonParameters> section. Some of its operations such as retrieving the StateMachineWorkflowInstance.StateHistory property may fail. To workaround this, specify the ConnectionString attribute in the configuration section for tracking provider, as indicated in the following example.

<add
type="System.Workflow.Runtime.Tracking.SqlTrackingService, System.Workflow.Runtime, Version=3.0.00000.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
ConnectionString="Data Source=localhost;Initial Catalog=Partner20WFTP;Integrated Security=True;" />

For services that commit work batches to persistence stores, such as DefaultWorkflowCommitWorkBatchService and SqlWorkflowPersistenceService, you can enable them to retry their transaction by using the EnableRetries parameter as shown in the following example:

<workflowRuntime name="SampleApplication"
                 unloadOnIdle="false">
  <commonParameters>
    <add name="ConnectionString"
         value="Initial Catalog=WorkflowStore;Data Source=localhost;Integrated Security=SSPI;" />
    <add name="EnableRetries"
         value="True" />
  </commonParameters>
  <services>
    <add type="System.Workflow.Runtime.Hosting.SqlWorkflowPersistenceService, System.Workflow.Runtime,
               Version=3.0.00000.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
         enableRetries="False" />
  </services>
</workflowRuntime>

Notice that the EnableRetries parameter can be set either at a global level (as shown in the CommonParameters section) or for individual services that support EnableRetries (as shown in the Services section).

The following sample code shows how to change the common parameters programmatically:

Configuration config = WebConfigurationManager.OpenWebConfiguration("/Workflow", "Default Web Site", null, "localhost");
var wfruntime = config.GetSection("WorkflowRuntime") as WorkflowRuntimeSection;  
NameValueConfigurationCollection commonParameters = wfruntime.CommonParameters;
commonParameters["ConnectionString"].Value="another connection string";  
config.Save();  

For more information about using a configuration file to control the behavior of a WorkflowRuntime object of a Windows Workflow Foundation host application, see Workflow Configuration Files.

Example

<commonParameters>
   <add name="ConnectionString"
        value="Initial Catalog=WorkflowStore;Data Source=localhost;Integrated Security=SSPI;" />
   <add name="EnableRetries"
        value="true" />
</commonParameters>

See also