Table of Contents

Interface IXrmContext

Namespace
Hsl.Xrm.Sdk
Assembly
Hsl.Xrm.Sdk.Core.dll

An abstraction for interaction with Dataverse.

Traditionally, business logic methods are tightly coupled to their caller. They typically have parameters that include an org service and also an object that allows for logging such as the tracing service or an Azure logger. Such code cannot easily be called from another context.

IXrmContext is an interface that provides access to org services and a generic logging interface. Using this interface allows business logic code with logging to be written once and called from plugins, console apps, unit tests, Azure, etc.

An immediately obvious benefit of using IXrmContext: you can develop and test a complex plugin almost entirely locally because you can execute your business logic from a console app!

See the IXrmContext article for more details.

public interface IXrmContext

Properties

InitiatingUserOrgService

The org service of the user that initiated the operation. Only available in plugin context.

IOrganizationService? InitiatingUserOrgService { get; }

Property Value

IOrganizationService

Logger

The logger for the context.

IHslLogger Logger { get; }

Property Value

IHslLogger

OrgService

The org service of the connected user.

IOrganizationService OrgService { get; }

Property Value

IOrganizationService

SystemOrgService

The org service of the system user. Only available in plugin context.

IOrganizationService? SystemOrgService { get; }

Property Value

IOrganizationService