The workflow runtime engine supports the concept of external services. Services are class instances that you create and register with the runtime during application startup. Each service fulfills a defined purpose. Services come in two varieties: core and local. The functionality provided by core services is defined by Microsoft. In some cases, the workflow runtime will register its own default implementation of a core service if you don’t provide your own. In other cases, the service is optional and a default is not automatically provided for you.
For example, persistence of workflows is important, especially when they are long-running. WF provides the SqlWorkflowPersistenceService class (found in the System.Workflow.Runtime.Hosting namespace) for this purpose. This is a service that handles the persistence duties using a SQL database. When a workflow instance is idled or suspended, its current state can be saved to a database. When the workflow instance is needed again, it is reconstituted within the workflow runtime by retrieving it from the database. By registering this service with the workflow runtime, all of your workflows make use of this functionality. If you prefer another persistence mechanism, you can derive your own persistence service from the abstract WorkflowPersistenceService class and register it with the runtime engine. The persistence service is considered a core workflow service.
Other core services include Commit Work Batch (DefaultWorkflowCommitWorkBatchService), runtime thread management (DefaultWorkflowSchedulerService), and workflow tracking (SqlTrackingService). All of these can be used in their default form or extended and enhanced by you.
On the other hand, local services are developed by you to serve any purpose. One common use of local services is to act as a communications conduit for workflows. The purpose, design, and implementation of this type of service class are completely up to you. You register a local service in a similar way to core services. Once your local service is registered with the runtime, a workflow can invoke methods on the service, or handle events that originate from the service. Local services are an important mechanism used by workflows to communication with other parts of your application.