Table of Contents

Class CallerScope

Namespace
Integrations.Application.Common
Assembly
Integrations.Application.dll

The caller for work that does not run inside an HTTP request: a consumed message (its publisher) or a scheduled job (the system). It flows with the async call, so it also reaches scopes created along the way (audit rows, nested units of work). The HTTP ICallerContext uses it when set and falls back to the request's user.

public sealed class CallerScope
Inheritance
CallerScope
Inherited Members

Remarks

It also carries the entity the work is for once EntityGuard has checked it, so provider-call audit rows written in their own scope can record it.

Properties

Caller

The caller for this flow; null inside an HTTP request (the request's user is the caller).

public ICallerContext? Caller { get; }

Property Value

ICallerContext

Current

The scope for the current async flow, if one was begun.

public static CallerScope? Current { get; }

Property Value

CallerScope

EntityId

The last entity access was granted to in this flow (for audit), set by EntityGuard.

public string? EntityId { get; set; }

Property Value

string

Methods

Begin(ICallerContext?)

Starts a scope for the rest of this async flow; dispose it to restore the previous one. Pass null for an HTTP request (the caller comes from the request's user; the scope only records the entity).

public static IDisposable Begin(ICallerContext? caller)

Parameters

caller ICallerContext

Returns

IDisposable