SaaS CMS has officially launched! Learn more now.

Class DefinitionHandler

Implementation of IDefinitionHandler. Handles workflow definitions

Inheritance
System.Object
DefinitionHandler
Implements
Inherited Members
System.Object.ToString()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
Namespace: EPiServer.WorkflowFoundation
Assembly: EPiServer.WorkflowFoundation.dll
Version: 7.19.2
Syntax
public class DefinitionHandler : IDefinitionHandler

Constructors

DefinitionHandler(IStorageProvider, IBroadcastHandler)

Do not create an instance of this object, use DefinitionHandler to get the singelton instance instead.

Declaration
public DefinitionHandler(IStorageProvider provider, IBroadcastHandler broadcastHandler)
Parameters
Type Name Description
IStorageProvider provider

storage provider

IBroadcastHandler broadcastHandler

The component that handles broadcast

Properties

BroadcastHandler

Handle to broadcast sender

Declaration
protected IBroadcastHandler BroadcastHandler { get; }
Property Value
Type Description
IBroadcastHandler

The broadcast handler.

Remarks

To change type override EPiServer.WorkflowFoundation.AspNetWorkflowManager.BroadcastHandler

RegisteredDependencyPaths

Returns paths to all registered custom dependencies

Declaration
public virtual ReadOnlyCollection<string> RegisteredDependencyPaths { get; }
Property Value
Type Description
System.Collections.ObjectModel.ReadOnlyCollection<System.String>

StorageProvider

Handle to storage provider

Declaration
protected IStorageProvider StorageProvider { get; }
Property Value
Type Description
IStorageProvider
Remarks

To change type override StorageProvider

WorkflowDefinitions

Accessor that loads definitions from storage if they are not loaded

Declaration
protected virtual Dictionary<Guid, WorkflowDefinition> WorkflowDefinitions { get; }
Property Value
Type Description
System.Collections.Generic.Dictionary<System.Guid, WorkflowDefinition>

Methods

ContainsDefinition(Guid)

Indicates wetter there exists an definition with this id

Declaration
public virtual bool ContainsDefinition(Guid definitionId)
Parameters
Type Name Description
System.Guid definitionId

definition id

Returns
Type Description
System.Boolean

wetter instance exist

ContainsDefinition(String)

Indicates wetter there exists an definition with this name

Declaration
public virtual bool ContainsDefinition(string definitionName)
Parameters
Type Name Description
System.String definitionName

the name of the definition to check for

Returns
Type Description
System.Boolean

wetter instance exist

DeleteDefinition(WorkflowDefinition)

Deletes the definition.

Declaration
protected virtual void DeleteDefinition(WorkflowDefinition definition)
Parameters
Type Name Description
WorkflowDefinition definition

The definition to delete

DeleteDefinition(Guid)

Unregisters a defintion from runtime

Declaration
public virtual void DeleteDefinition(Guid definitionId)
Parameters
Type Name Description
System.Guid definitionId

The id of the definition to delete

Exceptions
Type Condition
WorkflowDefinitionException

Definition not found or running instances

DeleteDefinition(String)

Unregisters a defintion from runtime

Declaration
public virtual void DeleteDefinition(string definitionName)
Parameters
Type Name Description
System.String definitionName

The name of the definition to delete

Exceptions
Type Condition
WorkflowDefinitionException

Definition not found or running instances

GetDefinition(Guid)

Returns the Workflow definition

Declaration
public virtual WorkflowDefinition GetDefinition(Guid definitionId)
Parameters
Type Name Description
System.Guid definitionId

unique id of definition

Returns
Type Description
WorkflowDefinition

definition

Exceptions
Type Condition
WorkflowDefinitionException

Definition not found

GetDefinition(String)

Returns the Workflow definition

Declaration
public virtual WorkflowDefinition GetDefinition(string definitionName)
Parameters
Type Name Description
System.String definitionName

unique name of definition

Returns
Type Description
WorkflowDefinition

definition

GetDefinitions()

Gets all registered Workflow definitions

Declaration
public virtual IList<WorkflowDefinition> GetDefinitions()
Returns
Type Description
System.Collections.Generic.IList<WorkflowDefinition>

List of all registered definitions

LoadDefinitions()

Loads definitions from storage

Declaration
protected virtual Dictionary<Guid, WorkflowDefinition> LoadDefinitions()
Returns
Type Description
System.Collections.Generic.Dictionary<System.Guid, WorkflowDefinition>

definitions

RegisterDefinition(String, String, Type)

Registers a compiled Workflow type with runtime

Declaration
public virtual CompiledWorkflowDefinition RegisterDefinition(string name, string description, Type compiledType)
Parameters
Type Name Description
System.String name

The name of the definiton, has to be unique

System.String description

A descrition of the definition

System.Type compiledType

The Workflow type to register

Returns
Type Description
CompiledWorkflowDefinition

definition

Remarks

The compiled type must be a workflow

Exceptions
Type Condition
WorkflowDefinitionException

If some input is not valid

RegisterDefinition(String, String, Type, AccessControlList)

Registers a compiled Workflow type with runtime

Declaration
public virtual CompiledWorkflowDefinition RegisterDefinition(string name, string description, Type compiledType, AccessControlList acl)
Parameters
Type Name Description
System.String name

The name of the definiton, has to be unique

System.String description

A descrition of the definition

System.Type compiledType

The Workflow type to register

AccessControlList acl

The acl.

Returns
Type Description
CompiledWorkflowDefinition

definition

Remarks

The compiled type must be a workflow

Exceptions
Type Condition
WorkflowDefinitionException

If some input is not valid

RegisterDependencyPath(String)

If custom activities has external dependencies they must be registered so activity can be compiled and loaded. Can be registered in web.config under references section

Declaration
public virtual void RegisterDependencyPath(string path)
Parameters
Type Name Description
System.String path

The path to referenced assembly

RegisterXomlDefinition(String, String, String, String, String, AccessControlList, out CompilerErrorCollection)

Registers a xoml based Workflow type with runtime

Declaration
public virtual XomlWorkflowDefinition RegisterXomlDefinition(string name, string description, string xoml, string cs, string rules, AccessControlList acl, out CompilerErrorCollection errors)
Parameters
Type Name Description
System.String name

The name of the definiton, has to be unique

System.String description

The description of the definition

System.String xoml

The xoml to register

System.String cs

C# based code beside associated with xoml (if any)

System.String rules

Rules associated with xoml (if any)

AccessControlList acl

The acl for the definition

System.CodeDom.Compiler.CompilerErrorCollection errors

errors/warnings from compilation

Returns
Type Description
XomlWorkflowDefinition

registered definition

Remarks

passed xoml, cs and rules will be compiled to assembly at registration. If there are dependencies to external types this can be registered in web.config under references section

Exceptions
Type Condition
WorkflowDefinitionException

If some input is not valid

RegisterXomlDefinition(String, String, String, String, String, out CompilerErrorCollection)

Registers a xoml based Workflow type with runtime

Declaration
public virtual XomlWorkflowDefinition RegisterXomlDefinition(string name, string description, string xoml, string cs, string rules, out CompilerErrorCollection errors)
Parameters
Type Name Description
System.String name

The name of the definiton, has to be unique

System.String description

The description of the definition

System.String xoml

The xoml to register

System.String cs

C# based code beside associated with xoml (if any)

System.String rules

Rules associated with xoml (if any)

System.CodeDom.Compiler.CompilerErrorCollection errors

errors/warnings from compilation

Returns
Type Description
XomlWorkflowDefinition

registered definition

Remarks

passed xoml, cs and rules will be compiled to assembly at registration. If there are dependencies to external types this can be registered in web.config under references section

Exceptions
Type Condition
WorkflowDefinitionException

If some input is not valid

RemoveUnusedAssemblies()

It might not be possible to remove an assembly from disk when xoml based definition is removed/updated due to the fact that it might have been loaded in AppDomain. A call to this method will try to delete unused assemblies from disk.

Declaration
public virtual void RemoveUnusedAssemblies()

SaveDefinition(CompiledWorkflowDefinition)

Saves the compiled workflow definition.

Declaration
public virtual void SaveDefinition(CompiledWorkflowDefinition definition)
Parameters
Type Name Description
CompiledWorkflowDefinition definition

The definition to save.

Exceptions
Type Condition
WorkflowDefinitionException

If input is not valid

SaveDefinition(WorkflowDefinition)

Saves the workflow definition.

Declaration
public virtual void SaveDefinition(WorkflowDefinition definition)
Parameters
Type Name Description
WorkflowDefinition definition

The definition to save.

Remarks

If xoml based is used the overloaded method with error collection is recommended, since it gives more detail if compilation fails.

Exceptions
Type Condition
WorkflowDefinitionException

If input is not valid

SaveDefinition(XomlWorkflowDefinition, out CompilerErrorCollection)

Saves the xoml based workflow definition.

Declaration
public virtual void SaveDefinition(XomlWorkflowDefinition definition, out CompilerErrorCollection errors)
Parameters
Type Name Description
XomlWorkflowDefinition definition

The definition to save.

System.CodeDom.Compiler.CompilerErrorCollection errors

compilation output

Remarks

passed xoml, cs and rules will be compiled to assembly at registration. If there are dependencies to external types this can be registered in web.config under references section

Exceptions
Type Condition
WorkflowDefinitionException

If some input is not valid

TryGetDefinition(Guid, out WorkflowDefinition)

Tries to get a defintion with given guid.

Declaration
public virtual bool TryGetDefinition(Guid definitionId, out WorkflowDefinition definition)
Parameters
Type Name Description
System.Guid definitionId

The id of the definition to get

WorkflowDefinition definition

The definition with the given id. Null if defintion does not exist

Returns
Type Description
System.Boolean

True if definition exists else false

TryGetDefinition(String, out WorkflowDefinition)

Tries to get a defintion with given name.

Declaration
public virtual bool TryGetDefinition(string definitionName, out WorkflowDefinition definition)
Parameters
Type Name Description
System.String definitionName

The name of the definition to get

WorkflowDefinition definition

The definition with the given name. Null if defintion does not exist

Returns
Type Description
System.Boolean

True if definition exists else false

Implements

Extension Methods