Table of Contents

Class PluginEventContext2<TEntity>

Namespace
Hsl.Xrm.Sdk.Plugin
Assembly
Hsl.Xrm.Sdk.Plugin.dll

Plugin event context class

public class PluginEventContext2<TEntity> : EventContext, IPluginEventContext2<TEntity>, IPluginEventContext2, IBasePluginEventContext, IEventContext where TEntity : Entity

Type Parameters

TEntity
Inheritance
PluginEventContext2<TEntity>
Implements
Inherited Members

Constructors

PluginEventContext2(string, PluginGeneralConfiguration, IServiceProvider)

Constructor that creates a tracing service logger.

public PluginEventContext2(string pluginName, PluginGeneralConfiguration generalConfig, IServiceProvider serviceProvider)

Parameters

pluginName string
generalConfig PluginGeneralConfiguration
serviceProvider IServiceProvider

Exceptions

ArgumentNullException

PluginEventContext2(string, PluginGeneralConfiguration, IServiceProvider, IHslLogger)

Constrcutor that allows for a custom logger to be used.

public PluginEventContext2(string pluginName, PluginGeneralConfiguration generalConfig, IServiceProvider serviceProvider, IHslLogger logger)

Parameters

pluginName string
generalConfig PluginGeneralConfiguration
serviceProvider IServiceProvider
logger IHslLogger

Exceptions

ArgumentNullException

Properties

Logger

The logger

public IHslLogger Logger { get; init; }

Property Value

IHslLogger

PluginContext

The context provided by the platform.

public IPluginExecutionContext PluginContext { get; }

Property Value

IPluginExecutionContext

ServiceProvider

The service provider provided by the platform

public IServiceProvider ServiceProvider { get; }

Property Value

IServiceProvider

Targets

The list of Targets

public IReadOnlyList<ITargetItem<TEntity>> Targets { get; }

Property Value

IReadOnlyList<ITargetItem<TEntity>>

TraceConfig

The configuration for tracing.

public PluginTraceConfiguration TraceConfig { get; }

Property Value

PluginTraceConfiguration

Methods

GetExecutionContext()

The execution context provided by the platform

protected override IExecutionContext GetExecutionContext()

Returns

IExecutionContext

Exceptions

InvalidOperationException

GetOrganizationServiceFactory()

The organization service factory provided by the platform

protected override IOrganizationServiceFactory GetOrganizationServiceFactory()

Returns

IOrganizationServiceFactory

Exceptions

InvalidOperationException

GetParentContext(IExecutionContext)

Gets the parent context for the current context or null if there is none.

protected override IExecutionContext? GetParentContext(IExecutionContext ctx)

Parameters

ctx IExecutionContext

Returns

IExecutionContext

GetSharedVariable<T>(string, bool, T?)

Gets a shared variable from the context.

public T? GetSharedVariable<T>(string name, bool includeParentContexts = true, T? defaultValue = default)

Parameters

name string
includeParentContexts bool
defaultValue T

Returns

T

Type Parameters

T

GetTraceLog()

Gets the trace log. Requires that EnableGetTraceLog is set to true in the constructor.

public string? GetTraceLog()

Returns

string

Exceptions

Exception

GetTracingService()

The tracing service provided by the platform

protected override ITracingService GetTracingService()

Returns

ITracingService