Class AspNetWorkflowManager
Workflow engine to be used within same AppDomain as EPiServer. Main component for workflow host implementation (implements IWorkflowManager)
Inheritance
Inherited Members
Namespace: EPiServer.WorkflowFoundation
Assembly: EPiServer.WorkflowFoundation.dll
Version: 8.11.0Syntax
public class AspNetWorkflowManager : IWorkflowManager, IDisposable, IBroadcastedUpdate
Remarks
Is used as a singleton object. Singelton instance can be accessed through WorkflowManager
To use other host (must implement IWorkflowManager) as engine for workflow system add it as type attribute on workflowHost configuration element in web.config
Constructors
AspNetWorkflowManager()
Initializes a new instance of the AspNetWorkflowManager class.
Declaration
public AspNetWorkflowManager()
AspNetWorkflowManager(Boolean)
Do not create an instance of this object, use WorkflowManager to get the singelton instance instead.
Declaration
public AspNetWorkflowManager(bool lazyLoading)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | lazyLoading |
Remarks
main initialization should be made by call to Initialize method
Properties
DefinitionHandler
Gets a handle to the definition handler
Declaration
public virtual IDefinitionHandler DefinitionHandler { get; }
Property Value
Type | Description |
---|---|
IDefinitionHandler |
Remarks
That is the component that handles workflow definitions
HasPersistenceService
Indicates if persistance service is registered
Declaration
protected bool HasPersistenceService { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
InstanceHandler
Gets a handle to the instance handler
Declaration
public virtual IInstanceHandler InstanceHandler { get; }
Property Value
Type | Description |
---|---|
IInstanceHandler |
Remarks
That is the component that handles workflow instances
IsStarted
States wether runtime is started
Declaration
public virtual bool IsStarted { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
StorageProvider
Gets storage provider
Declaration
protected virtual IStorageProvider StorageProvider { get; }
Property Value
Type | Description |
---|---|
IStorageProvider |
Remarks
Override if custom storage is to be used
Methods
AddCommunicationServiceToRuntime(ExternalDataExchangeService)
Adds communication service to runtime.
Declaration
protected virtual void AddCommunicationServiceToRuntime(ExternalDataExchangeService dataService)
Parameters
Type | Name | Description |
---|---|---|
System.Workflow.Activities.ExternalDataExchangeService | dataService | The ExternalDataExchangeService to add CommunicationService to |
Remarks
To get custom class registered with runtime as IWorkflowCommunication this method should be overriden
If other IInstanceHandler implementer than InstanceHandler is to be used this method should be overriden
CreateBroadcastHandler()
Creates an instance of the component implementing IBroadcastHandler
Declaration
protected virtual IBroadcastHandler CreateBroadcastHandler()
Returns
Type | Description |
---|---|
IBroadcastHandler | IBroadcastHandler |
Remarks
If other IBroadcastHandler implementer than EPiServer.WorkflowFoundation.Broadcast.BroadcastOperations is to be used this method should be overriden. That is e.g. if other broadcasting than UDP is to be used
CreateDefinitionHandler()
Creates an instance of the component implementing IDefinitionHandler
Declaration
protected virtual IDefinitionHandler CreateDefinitionHandler()
Returns
Type | Description |
---|---|
IDefinitionHandler | IDefinitionHandler |
Remarks
If other IDefinitionHandler implementer than DefinitionHandler is to be used this method should be overriden. The default implementaion will look for configuration setting WorkflowDelayedLoading to see if it should load data from storage at initialization time.
If you override this method and use other IInstanceHandler than default then methods ReloadDefinitions(), ReloadDefinition(Guid) and RemoveDefinitionLocally(Guid) should also be overriden since they use DefinitionHandler.
CreateInstanceHandler()
Creates an instance of the component implementing IInstanceHandler
Declaration
protected virtual IInstanceHandler CreateInstanceHandler()
Returns
Type | Description |
---|---|
IInstanceHandler | IInstanceHandler |
Remarks
If other IInstanceHandler implementer than InstanceHandler is to be used this method should be overriden. The default implementaion will look for configuration setting WorkflowDelayedLoading to see if it should load data from storage at initialization time.
If you override this method and use other IInstanceHandler than default then methods ReloadInstances(), ReloadInstance(Guid), RemoveInstance(Guid) and RemoveInstanceLocally(Guid) should also be overriden since they use InstanceHandler.
Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
Declaration
public void Dispose()
Dispose(Boolean)
Disposes the specified only native.
Declaration
protected virtual void Dispose(bool onlyNative)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | onlyNative | if set to |
GetAllServices(Type)
Retrieves all the services that have been added to the Workflow runtime engine that implement or derive from a specified Type.
Declaration
public virtual ReadOnlyCollection<object> GetAllServices(Type serviceType)
Parameters
Type | Name | Description |
---|---|---|
System.Type | serviceType | service type |
Returns
Type | Description |
---|---|
System.Collections.ObjectModel.ReadOnlyCollection<System.Object> | services |
GetEventInformation()
Gets information about which instances that are waiting for which event
Declaration
public virtual IDictionary<string, IList<Guid>> GetEventInformation()
Returns
Type | Description |
---|---|
System.Collections.Generic.IDictionary<System.String, System.Collections.Generic.IList<System.Guid>> | Dictionary containing eventnames and list of instance ids for each eventname |
GetService(Type)
Gets an registered service, e.g. a custom service registered with ExchangeDataService which custom communication with Workflow instance can be performed
Declaration
public virtual 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
public 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 internal services are added to runtime
Declaration
public virtual void Initialize(bool lazyLoading)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | lazyLoading | if set to |
RegisterExternalExchangeDataService(Object)
Registers a custom type with ExternalDataExchangeService
Declaration
public virtual 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 System.Workflow.Activities.ExternalDataExchangeAttribute attribute should be supplied
RegisterService(Object)
Register a service to the Rutime service collection
Declaration
public virtual void RegisterService(object service)
Parameters
Type | Name | Description |
---|---|---|
System.Object | service | The service. |
RegisterType(Type)
Registers an external type with TypeProvider
Declaration
public virtual void RegisterType(Type type)
Parameters
Type | Name | Description |
---|---|---|
System.Type | type | type to register |
ReloadDefinition(Guid)
Calls DefinitionHandler to reload a definition from storage
Declaration
protected virtual void ReloadDefinition(Guid definitionId)
Parameters
Type | Name | Description |
---|---|---|
System.Guid | definitionId | The definition id. |
Remarks
If other IDefinitionHandler implementer than DefinitionHandler is to be used this method should be overriden
ReloadDefinitions()
Calls DefinitionHandler to reload definitions from storage
Declaration
protected virtual void ReloadDefinitions()
Remarks
If other IDefinitionHandler implementer than DefinitionHandler is to be used this method should be overriden
ReloadInstance(Guid)
Calls InstanceHandler to reload an instance from storage
Declaration
protected virtual void ReloadInstance(Guid instanceId)
Parameters
Type | Name | Description |
---|---|---|
System.Guid | instanceId | The instance id. |
Remarks
If other IInstanceHandler implementer than InstanceHandler is to be used this method should be overriden
ReloadInstances()
Calls InstanceHandler to reload instances from storage
Declaration
protected virtual void ReloadInstances()
Remarks
If other IInstanceHandler implementer than InstanceHandler is to be used this method should be overriden
RemoveDefinitionLocally(Guid)
Calls DefinitionHandler to remove a definition locally (that is no message is broadcasted)
Declaration
protected virtual void RemoveDefinitionLocally(Guid definitionId)
Parameters
Type | Name | Description |
---|---|---|
System.Guid | definitionId | The definition id. |
Remarks
If other IDefinitionHandler implementer than DefinitionHandler is to be used this method should be overriden
RemoveInstance(Guid)
Calls InstanceHandler to remove instance both in memory and storage (if broadcast is used this should be broadcasted)
Declaration
protected virtual void RemoveInstance(Guid instanceId)
Parameters
Type | Name | Description |
---|---|---|
System.Guid | instanceId | The instance id. |
Remarks
If other IInstanceHandler implementer than InstanceHandler is to be used this method should be overriden
RemoveInstanceLocally(Guid)
Calls InstanceHandler to remove instance locally (that is no broadcast message is sent)
Declaration
protected virtual void RemoveInstanceLocally(Guid instanceId)
Parameters
Type | Name | Description |
---|---|---|
System.Guid | instanceId |
Remarks
If other IInstanceHandler implementer than InstanceHandler is to be used this method should be overriden
RemoveService(Object)
Removes a registered service
Declaration
public virtual void RemoveService(object service)
Parameters
Type | Name | Description |
---|---|---|
System.Object | service | The service to remove |
StartRuntime()
Starts the Workflow runtime
Declaration
public virtual void StartRuntime()
StopRuntime()
Stops the Workflow runtime
Declaration
public virtual void StopRuntime()
UnregisterType(Type)
Unregisters an external type from TypeProvider
Declaration
public virtual 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
public 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
public event EventHandler<PageRelatedEventArgs> PageRelatedEvent
Event Type
Type | Description |
---|---|
System.EventHandler<PageRelatedEventArgs> |
Examples
Shows how event can be used to start new workflow instance
RuntimeStarted
Occurrs when the Workflow runtime is started
Declaration
public event EventHandler<WorkflowRuntimeEventArgs> RuntimeStarted
Event Type
Type | Description |
---|---|
System.EventHandler<System.Workflow.Runtime.WorkflowRuntimeEventArgs> |
RuntimeStopped
Occurrs when the Workflow runtime is stopped
Declaration
public 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
public event EventHandler<ServicesExceptionNotHandledEventArgs> ServicesExceptionNotHandled
Event Type
Type | Description |
---|---|
System.EventHandler<System.Workflow.Runtime.ServicesExceptionNotHandledEventArgs> |
WorkflowAborted
Occurrs when a Workflow instance is aborted
Declaration
public event EventHandler<WorkflowEventArgs> WorkflowAborted
Event Type
Type | Description |
---|---|
System.EventHandler<System.Workflow.Runtime.WorkflowEventArgs> |
WorkflowCompleted
Occurrs when a Workflow instance is completed
Declaration
public 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
public event EventHandler<WorkflowEventArgs> WorkflowCreated
Event Type
Type | Description |
---|---|
System.EventHandler<System.Workflow.Runtime.WorkflowEventArgs> |
WorkflowIdled
Occurrs when a Workflow instance is idled
Declaration
public event EventHandler<WorkflowEventArgs> WorkflowIdled
Event Type
Type | Description |
---|---|
System.EventHandler<System.Workflow.Runtime.WorkflowEventArgs> |
WorkflowLoaded
Occurrs when a Workflow instance is loaded
Declaration
public event EventHandler<WorkflowEventArgs> WorkflowLoaded
Event Type
Type | Description |
---|---|
System.EventHandler<System.Workflow.Runtime.WorkflowEventArgs> |
WorkflowPersisted
Occurrs when a Workflow instance is peristed
Declaration
public event EventHandler<WorkflowEventArgs> WorkflowPersisted
Event Type
Type | Description |
---|---|
System.EventHandler<System.Workflow.Runtime.WorkflowEventArgs> |
WorkflowResumed
Occurrs when a Workflow instance is resumed
Declaration
public event EventHandler<WorkflowEventArgs> WorkflowResumed
Event Type
Type | Description |
---|---|
System.EventHandler<System.Workflow.Runtime.WorkflowEventArgs> |
WorkflowStarted
Occurrs when a Workflow instance is started
Declaration
public event EventHandler<WorkflowEventArgs> WorkflowStarted
Event Type
Type | Description |
---|---|
System.EventHandler<System.Workflow.Runtime.WorkflowEventArgs> |
WorkflowSuspended
Occurrs when a Workflow instance is suspended
Declaration
public event EventHandler<WorkflowSuspendedEventArgs> WorkflowSuspended
Event Type
Type | Description |
---|---|
System.EventHandler<System.Workflow.Runtime.WorkflowSuspendedEventArgs> |
WorkflowTerminated
Occurrs when a Workflow instance is terminated
Declaration
public 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
public event EventHandler<WorkflowEventArgs> WorkflowUnloaded
Event Type
Type | Description |
---|---|
System.EventHandler<System.Workflow.Runtime.WorkflowEventArgs> |
Explicit Interface Implementations
IBroadcastedUpdate.DeleteDefinition(Guid)
Deletes the definition.
Declaration
void IBroadcastedUpdate.DeleteDefinition(Guid definitionId)
Parameters
Type | Name | Description |
---|---|---|
System.Guid | definitionId | The definition id. |
IBroadcastedUpdate.DeleteInstance(Guid)
Deletes the instance.
Declaration
void IBroadcastedUpdate.DeleteInstance(Guid instanceId)
Parameters
Type | Name | Description |
---|---|---|
System.Guid | instanceId | The instance id. |
IBroadcastedUpdate.Reload()
Reload data.
Declaration
void IBroadcastedUpdate.Reload()
IBroadcastedUpdate.UpdateDefinition(Guid)
Updates the definition.
Declaration
void IBroadcastedUpdate.UpdateDefinition(Guid definitionId)
Parameters
Type | Name | Description |
---|---|---|
System.Guid | definitionId | The definition id. |
IBroadcastedUpdate.UpdateInstance(Guid)
Updates the instance.
Declaration
void IBroadcastedUpdate.UpdateInstance(Guid instanceId)
Parameters
Type | Name | Description |
---|---|---|
System.Guid | instanceId | The instance id. |