Class ActivityScope
- Namespace
- Temporalio.Extensions.Hosting
- Assembly
- Temporalio.Extensions.Hosting.dll
Information and ability to control the activity DI scope.
public static class ActivityScope
- Inheritance
-
ActivityScope
- Inherited Members
Properties
ScopedInstance
Gets or sets the scoped instance for non-static activity methods.
public static object? ScopedInstance { get; set; }
Property Value
Remarks
This is backed by an async local. By default, when the activity invocation starts (meaning inside the interceptor, not before) for a non-static method, an instance is obtained from the service provider and set on this value. This means it will not be present in the primary execute-activity interceptor (ExecuteActivityAsync(ExecuteActivityInput)) call but will be available everywhere else the ActivityExecutionContext is. See the next remark for how to control the instance.
ServiceScope
Gets or sets the current scope for this activity.
public static IServiceScope? ServiceScope { get; set; }
Property Value
Remarks
This is backed by an async local. By default, when the activity invocation starts (meaning inside the interceptor, not before), a new service scope is created and set on this value. This means it will not be present in the primary execute-activity interceptor (ExecuteActivityAsync(ExecuteActivityInput)) call but will be available everywhere else the ActivityExecutionContext is. When set by the internal code, it is also disposed by the internal code. See the next remark for how to control the scope.