<p>
There are two ways to add local service to workflow runtime, programatically or declaratively. Below is section of code that do it programatically.
</p>
<pre data-sub="prettyprint:_">
private static void AddServices(WorkflowRuntime instance)
{
//add the external data exchange service to the runtime
ExternalDataExchangeService exchangeService
= new ExternalDataExchangeService();
instance.AddService(exchangeService);
//add our custom local service
//to the external data exchange service
exchangeService.AddService(new AccountService());
}
</pre>
<p>
Or you can do it using config file. Below is section of the configuration file.
</p>
<code>
<configuration>
<configSections>
<section name="WorkflowRuntime"
type="System.Workflow.Runtime.Configuration.WorkflowRuntimeSection,
System.Workflow.Runtime, Version=3.0.00000.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35" />
<section name="LocalServices"
type="System.Workflow.Activities.ExternalDataExchangeServiceSection,
System.Workflow.Activities, Version=3.0.0.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35"/>
</configSections>
<WorkflowRuntime Name="ConsoleLocalServices" >
<CommonParameters>
<!--Add parameters common to all services-->
</CommonParameters>
<Services>
<!--Add core services here-->
</Services>
</WorkflowRuntime>
<LocalServices >
<Services>
<!--Add local services here-->
<add type="SharedWorkflows.AccountService,
SharedWorkflows,Version=1.0.0.0,
Culture=neutral, PublicKeyToken=null" />
</Services>
</LocalServices >
</configuration>
</pre>