Table of Contents

Class WorkflowAttribute

Namespace
Temporalio.Workflows
Assembly
Temporalio.dll

Designate a type as a workflow.

[AttributeUsage(AttributeTargets.Class|AttributeTargets.Struct|AttributeTargets.Interface, Inherited = false)]
public sealed class WorkflowAttribute : Attribute
Inheritance
WorkflowAttribute
Inherited Members

Remarks

This attribute is not inherited, so if a base class has this attribute the registered subclass must have it too. Workflows must have a no-arg constructor unless there is a constructor with WorkflowInitAttribute. All workflows must have a single WorkflowRunAttribute.

Constructors

WorkflowAttribute()

Initializes a new instance of the WorkflowAttribute class with the default name. See Name.

public WorkflowAttribute()

WorkflowAttribute(string)

Initializes a new instance of the WorkflowAttribute class with the given name.

public WorkflowAttribute(string name)

Parameters

name string

Workflow type name to use. See Name.

Properties

Dynamic

Gets or sets a value indicating whether the workflow is dynamic. If a workflow is dynamic, it cannot by given a name in this attribute and the run method must an array of IRawValue.

public bool Dynamic { get; set; }

Property Value

bool

FailureExceptionTypes

Gets or sets the types of exceptions that, if a workflow-thrown exception extends, will cause the workflow/update to fail instead of suspending the workflow via task failure. These are applied in addition to WorkflowFailureExceptionTypes for the overall worker. If typeof(Exception) is set, it effectively will fail a workflow/update in all user exception cases.

public Type[]? FailureExceptionTypes { get; set; }

Property Value

Type[]

Remarks

WARNING: This property is experimental and may change in the future. If unset (i.e. left null), currently the default is to only fail the workflow/update on FailureException + cancellation and suspend via task failure all others. But this default may change in the future.

Name

Gets the workflow type name. If this is unset, it defaults to the unqualified type name. If the type is an interface and the first character is a capital "I" followed by another capital letter, the "I" is trimmed when creating the default name.

public string? Name { get; }

Property Value

string