IExecutionContext
interfaceWhat every handler gets, whatever kind it is. Steps, custom APIs and jobs all extend this.
IOrganizationService Service |
The organization service as the calling user. |
|---|---|
IOrganizationService SystemService |
The service as SYSTEM — bypasses the caller's privileges. Use deliberately. |
IOrganizationService ServiceAs(Guid userId) |
The service impersonating a specific user. |
Guid UserId |
The user the step executes as. |
Guid InitiatingUserId |
The user who started the request — differs from UserId under impersonation. |
Guid BusinessUnitId |
Business unit of the executing user. |
int Depth |
Pipeline depth. 1 is a top-level call. |
bool IsNested |
True when this execution was triggered by another plugin — the usual recursion guard. |
Guid CorrelationId |
Correlates every step in one logical operation. |
int UserLcid |
The user's language, for localized messages. |
DateTime UtcNow |
The execution's timestamp. Injectable, so tests are not clock-dependent. |
ISharedVariables Shared |
Typed shared variables, passed between steps in the same pipeline. |
IEnvironmentVariables Env |
Environment variables, read by schema name. |
IAsyncJobs Async |
Enqueue an async job transactionally. |
IPluginHttp Http |
Outbound HTTP from the sandbox. |
IManagedIdentityTokens ManagedIdentity |
Azure tokens via the assembly's managed identity — no stored credentials. |
void Trace(string message, params object?[] args) |
Write to the plugin trace log, prefixed with the step key. |
InvalidPluginExecutionException Fail(string message) |
Build the exception that aborts the operation. Throw the result. |
InvalidPluginExecutionException Fail(string message, int errorCode) |
As above, with an error code. |
InvalidPluginExecutionException FailLocalized(string resourceKey, params object?[] args) |
Fail with a message resolved from the [LocalizedStrings] catalog in the user's language. |
IPluginExecutionContext Raw |
The platform context, for anything dverse does not wrap. |
IServiceProvider Services |
The raw service provider. |
ITracingService Tracing |
The raw tracing service. |