Class EventContext
public abstract class EventContext : IEventContext
- Inheritance
-
EventContext
- Implements
- Derived
- Inherited Members
Constructors
EventContext()
public EventContext()
Fields
NoContextWithoutServiceProvider
protected static readonly string NoContextWithoutServiceProvider
Field Value
NoOrgServiceFactoryWithoutServiceProvider
protected static readonly string NoOrgServiceFactoryWithoutServiceProvider
Field Value
NoTracingServiceWithoutServiceProvider
protected static readonly string NoTracingServiceWithoutServiceProvider
Field Value
Properties
ActionTypeName
public string ActionTypeName { get; protected set; }
Property Value
ExecutionContext
Gets the execution context for the event execution instance.
public IExecutionContext ExecutionContext { get; }
Property Value
InitiatingUserOrgService
Gets an organization service using the initiating user's context.
protected IOrganizationService InitiatingUserOrgService { get; }
Property Value
IsExecutingAsynchronously
Indicates if executing asynchronously.
public bool IsExecutingAsynchronously { get; }
Property Value
IsExecutingInSandbox
Indicates if executing in Sandbox isolation mode.
public bool IsExecutingInSandbox { get; }
Property Value
IsExecutingSynchronously
Indicates if executing synchronously.
public bool IsExecutingSynchronously { get; }
Property Value
SystemOrgService
Gets an organization service using the system user's context.
protected IOrganizationService SystemOrgService { get; }
Property Value
TracingService
Gets the Tracing service from the plugin context.
public ITracingService TracingService { get; }
Property Value
UserOrgService
Gets an organization service using the user's context.
protected IOrganizationService UserOrgService { get; }
Property Value
XrmContext
public IXrmContext XrmContext { get; protected set; }
Property Value
Methods
Assert(bool, string, params object[])
Asserts the specified condition by throwing an InvalidPluginExecutionException if the condition is false.
public void Assert(bool condition, string message, params object[] args)
Parameters
condition
boolThe condition to assert.
message
stringThe message for the exception.
args
object[]Arguments used for substituion into the placeholders contained in the message.
BuildInnerException(Exception)
public Exception? BuildInnerException(Exception ex)
Parameters
ex
Exception
Returns
CanSendException(Exception)
Whether the Exception can be sent/deserialized.
public bool CanSendException(Exception ex)
Parameters
ex
Exception
Returns
GetExecutionContext()
protected abstract IExecutionContext GetExecutionContext()
Returns
GetOrgService(Guid?)
Gets an organization service using the specified user.
public IOrganizationService GetOrgService(Guid? userId)
Parameters
userId
Guid?Specifies the user context for the OrganizationService that is retrieved. A null value indicates the SYSTEM user. A Guid.Empty value indicates the same user a IExecutionContext.UserId Any other value indicates a specific user.
Returns
GetOrganizationServiceFactory()
protected abstract IOrganizationServiceFactory GetOrganizationServiceFactory()
Returns
GetParentContext(IExecutionContext)
protected abstract IExecutionContext? GetParentContext(IExecutionContext ctx)
Parameters
Returns
GetTracingService()
protected abstract ITracingService GetTracingService()
Returns
Throw(string, Exception?, params object[])
Throws an InvalidPluginExecutionException with the specified message and inner exception.
public void Throw(string message, Exception? inner, params object[] args)
Parameters
message
stringThe message for the exception.
inner
ExceptionThe inner exception.
args
object[]Arguments used for substitution into the placeholders contains in the message.
Trace(string, params object[])
Traces data to the tracing service if it is available.
public virtual void Trace(string message, params object[] args)
Parameters
TraceException(string, Exception, params object[])
Traces an Exception with the specified message.
public void TraceException(string message, Exception ex, params object[] args)