SaaS CMS has officially launched! Learn more now.

Interface IDefinitionHandler

Specifies methods etc. regarding definition handling

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

Properties

RegisteredDependencyPaths

Returns paths to all registered custom dependencies

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

Methods

ContainsDefinition(Guid)

Indicates wetter there exists an definition with this id

Declaration
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
bool ContainsDefinition(string definitionName)
Parameters
Type Name Description
System.String definitionName

Name of the definition to check for

Returns
Type Description
System.Boolean

wetter instance exist

DeleteDefinition(Guid)

Removes a defintion from runtime

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

The id of the definition that is to be deleted

Exceptions
Type Condition
WorkflowDefinitionException

Definition not found or running instances

DeleteDefinition(String)

Removes a defintion from runtime

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

Name of the definition that is to be deleted

Exceptions
Type Condition
WorkflowDefinitionException

Definition not found or running instances

GetDefinition(Guid)

Returns the Workflow definition with specified id

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

unique id of definition

Returns
Type Description
WorkflowDefinition

workflow definition

Exceptions
Type Condition
WorkflowDefinitionException

Definition not found

GetDefinition(String)

Returns the Workflow definition with specified name

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

unique name of definition

Returns
Type Description
WorkflowDefinition

workflow definition

Remarks

returns null if definition not exist

GetDefinitions()

Gets all registered Workflow definitions

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

A list of all registered workflow definitions

RegisterDefinition(String, String, Type)

Registers a compiled Workflow type with runtime

Declaration
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
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 also be registered in web.config under references configuration setting

Declaration
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
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
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
void RemoveUnusedAssemblies()

SaveDefinition(CompiledWorkflowDefinition)

Saves the compiled workflow definition.

Declaration
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
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
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
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

Returns
Type Description
System.Boolean

True if definition exists else false

TryGetDefinition(String, out WorkflowDefinition)

Tries to get a defintion with given name.

Declaration
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

Returns
Type Description
System.Boolean

True if definition exists else false

Extension Methods