-
Notifications
You must be signed in to change notification settings - Fork 1
IPluginExecutionContext Extensions
Set of extension methods for Microsoft.Xrm.Sdk.IPluginExecutionContext base class. Most of this helpers are shortcuts for existing properties but provides additional checks or type casts. Unlike Entity class extensions most of the following extensions are not exception safe! It is done so because you most likely want to get an error if plugin is registered for a wrong message or you have a typo in parameter name.
Return OrganizationId and OrganizationName fields as single EntityReference.
public EntityReference GetOrganization();
Return PrimaryEntityId and PrimaryEntityName fields as single EntityReference.
public EntityReference GetPrimaryEntity();
Return UserId field as EntityReference.
public EntityReference GetUser();
Return InitiatingUserId field as EntityReference.
public EntityReference GetInitiatingUser();
Return BusinessUnitId field as EntityReference.
public EntityReference GetBusinessUnit();
Gets input paramer as the specified type.
public T GetInputParameter<T>(String name) where;
Gets output paramer as the specified type.
public T GetOutputParameter<T>(String name);
Gets pre image.
public Entity GetPreImage(String name);
Gets pre image as the specified type.
public T GetPreImage<T>(String name) where T : Entity;
Gets post image.
public Entity GetPostImage(String name);
Gets post image as the specified type.
public T GetPostImage<T>(String name) where T : Entity;
Shortcut for getting "Target" input parameter of type Entity.
public Entity GetTarget();
Shortcut for getting "Target" input parameter as the specified type.
public T GetTarget<T>() where T : Entity;
Get "Target" entity parameter merged with specified pre image.
public T GetPreTarget<T>(String name) where T : Entity;
Get "Target" entity parameter merged with specified post image.
public T GetPostTarget<T>(String name) where T : Entity;
Gets shared Variable.
public T GetSharedVariable<T>(String name);
Simplifies handling of Associate and Disassociate messages. This messages can't be filtered by entity type, furthermore two options possible: when "A" entity is associated with array of "B", or "B" is associated with array of "A". This method generates universal dictionary of arguments which is suitable in all cases.
public Dictionary<EntityReference, EntityReferenceCollection> GetRelatedEntitiesByTarget(String keyEntity, String valueEntity);