SaaS CMS has officially launched! Learn more now.

Interface IWorkflowManager

Interface a class acting as a Host for Workflow must implement.

Namespace: EPiServer.WorkflowFoundation.Interfaces
Assembly: EPiServer.WorkflowFoundation.dll
Version: 7.19.2
Syntax
public interface IWorkflowManager
Remarks

Class implementing this interface and will act as workflow engine must have a public parameterless constructor.

Properties

DefinitionHandler

Gets a handle to the definition handler

Declaration
IDefinitionHandler DefinitionHandler { get; }
Property Value
Type Description
IDefinitionHandler
Remarks

That is the component that handles workflow definitions

InstanceHandler

Gets a handle to the instance handler

Declaration
IInstanceHandler InstanceHandler { get; }
Property Value
Type Description
IInstanceHandler
Remarks

That is the component that handles workflow instances

IsStarted

States wether runtime is started

Declaration
bool IsStarted { get; }
Property Value
Type Description
System.Boolean

Methods

GetAllServices(Type)

Gets all registered service of a certain type (can be registered in web.config)

Declaration
ReadOnlyCollection<object> GetAllServices(Type serviceType)
Parameters
Type Name Description
System.Type serviceType

The type of the service

Returns
Type Description
System.Collections.ObjectModel.ReadOnlyCollection<System.Object>

The instance of the service loaded in Workflow runtime

GetService(Type)

Gets an registered service, i.e. an custom service registered with ExchangeDataService which custom communication with Workflow instance can be performed

Declaration
object GetService(Type serviceType)
Parameters
Type Name Description
System.Type serviceType

The type of the service

Returns
Type Description
System.Object

The instance of the service loaded in Workflow runtime

GetService<T>()

Gets an registered service of specified generic type, i.e. an custom service registered with ExchangeDataService which custom communication with Workflow instance can be performed

Declaration
T GetService<T>()
Returns
Type Description
T

The instance of the service loaded in Workflow runtime

Type Parameters
Name Description
T

Initialize(Boolean)

Initializes component, should be called before usage. Here is where services are added to runtime

Declaration
void Initialize(bool lazyLoading)
Parameters
Type Name Description
System.Boolean lazyLoading

if set to true lazyLoading should be used. Meaning resources should be loaded when needed

RegisterExternalExchangeDataService(Object)

Registers custom type with ExternalDataExchangeService

Declaration
void RegisterExternalExchangeDataService(object externalExchangeDataService)
Parameters
Type Name Description
System.Object externalExchangeDataService

custom service to register

Remarks

To communicate with custom activities deriving from System.Workflow.Activities.HandleExternalEventActivity a class implementing an interface marked with ExternalDataExchange attribute should be supplied

RegisterService(Object)

Register the service to the Rutime service collection

Declaration
void RegisterService(object service)
Parameters
Type Name Description
System.Object service

The service.

RegisterType(Type)

Registers an external type with the TypeProvider

Declaration
void RegisterType(Type type)
Parameters
Type Name Description
System.Type type

the type to register

RemoveService(Object)

Removes a registered service

Declaration
void RemoveService(object service)
Parameters
Type Name Description
System.Object service

The service to remove

StartRuntime()

Starts the Workflow runtime

Declaration
void StartRuntime()
Remarks

This is where event listening from DataFactory and file system is setup

StopRuntime()

Stops the Workflow runtime

Declaration
void StopRuntime()

UnregisterType(Type)

unregisters an external type with the TypeProvider

Declaration
void UnregisterType(Type type)
Parameters
Type Name Description
System.Type type

the type to unregister

Events

FileSystemRelatedEvent

Occurrs when a FileSystem related event occurs from EPiServer file system. It is also possible to start new workflow instance and pass arguments to instance by setting properties on argument class.

Declaration
event EventHandler<FileSystemRelatedEventArgs> FileSystemRelatedEvent
Event Type
Type Description
System.EventHandler<FileSystemRelatedEventArgs>
Examples

Shows how event can be used to start new workflow instance

PageRelatedEvent

Occurrs when a page related event occurs from DataFactory. Gives chance to cancel event by setting CancelAction to true. It is also possible to start new workflow instance and pass arguments to instance by setting properties on argument class.

Declaration
event EventHandler<PageRelatedEventArgs> PageRelatedEvent
Event Type
Type Description
System.EventHandler<PageRelatedEventArgs>
Remarks

CancelAction has not meaning for all events

Examples

Shows how event can be used to start new workflow instance

RuntimeStarted

Occurrs when the Workflow runtime is started

Declaration
event EventHandler<WorkflowRuntimeEventArgs> RuntimeStarted
Event Type
Type Description
System.EventHandler<System.Workflow.Runtime.WorkflowRuntimeEventArgs>

RuntimeStopped

Occurrs when the Workflow runtime is stopped

Declaration
event EventHandler<WorkflowRuntimeEventArgs> RuntimeStopped
Event Type
Type Description
System.EventHandler<System.Workflow.Runtime.WorkflowRuntimeEventArgs>

ServicesExceptionNotHandled

Occurrs when a registered service throws an unhandled exception

Declaration
event EventHandler<ServicesExceptionNotHandledEventArgs> ServicesExceptionNotHandled
Event Type
Type Description
System.EventHandler<System.Workflow.Runtime.ServicesExceptionNotHandledEventArgs>

WorkflowAborted

Occurrs when a Workflow instance is aborted

Declaration
event EventHandler<WorkflowEventArgs> WorkflowAborted
Event Type
Type Description
System.EventHandler<System.Workflow.Runtime.WorkflowEventArgs>

WorkflowCompleted

Occurrs when a Workflow instance is completed

Declaration
event EventHandler<WorkflowCompletedEventArgs> WorkflowCompleted
Event Type
Type Description
System.EventHandler<System.Workflow.Runtime.WorkflowCompletedEventArgs>
Remarks

It is possible to get the corresponding WorkflowDefinitionInstance in this event. It will though not be possible to edit it since it will be removed

Examples

Example on how completed event can be used

WorkflowCreated

Occurrs when a Workflow instance is created

Declaration
event EventHandler<WorkflowEventArgs> WorkflowCreated
Event Type
Type Description
System.EventHandler<System.Workflow.Runtime.WorkflowEventArgs>

WorkflowIdled

Occurrs when a Workflow instance is idled

Declaration
event EventHandler<WorkflowEventArgs> WorkflowIdled
Event Type
Type Description
System.EventHandler<System.Workflow.Runtime.WorkflowEventArgs>

WorkflowLoaded

Occurrs when a Workflow instance is loaded

Declaration
event EventHandler<WorkflowEventArgs> WorkflowLoaded
Event Type
Type Description
System.EventHandler<System.Workflow.Runtime.WorkflowEventArgs>

WorkflowPersisted

Occurrs when a Workflow instance is peristed

Declaration
event EventHandler<WorkflowEventArgs> WorkflowPersisted
Event Type
Type Description
System.EventHandler<System.Workflow.Runtime.WorkflowEventArgs>

WorkflowResumed

Occurrs when a Workflow instance is resumed

Declaration
event EventHandler<WorkflowEventArgs> WorkflowResumed
Event Type
Type Description
System.EventHandler<System.Workflow.Runtime.WorkflowEventArgs>

WorkflowStarted

Occurrs when a Workflow instance is started

Declaration
event EventHandler<WorkflowEventArgs> WorkflowStarted
Event Type
Type Description
System.EventHandler<System.Workflow.Runtime.WorkflowEventArgs>

WorkflowSuspended

Occurrs when a Workflow instance is suspended

Declaration
event EventHandler<WorkflowSuspendedEventArgs> WorkflowSuspended
Event Type
Type Description
System.EventHandler<System.Workflow.Runtime.WorkflowSuspendedEventArgs>

WorkflowTerminated

Occurrs when a Workflow instance is terminated

Declaration
event EventHandler<WorkflowTerminatedEventArgs> WorkflowTerminated
Event Type
Type Description
System.EventHandler<System.Workflow.Runtime.WorkflowTerminatedEventArgs>
Remarks

It is possible to get the corresponding WorkflowDefinitionInstance in this event. It will though not be possible to edit it since it will be deleted

Examples

Example on how terminated event can be used to clean up

WorkflowUnloaded

Occurrs when a Workflow instance is Unloaded

Declaration
event EventHandler<WorkflowEventArgs> WorkflowUnloaded
Event Type
Type Description
System.EventHandler<System.Workflow.Runtime.WorkflowEventArgs>

Extension Methods