D365Extensions 1.0.17

There is a newer version of this package available.
See the version list below for details.
dotnet add package D365Extensions --version 1.0.17                
NuGet\Install-Package D365Extensions -Version 1.0.17                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="D365Extensions" Version="1.0.17" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add D365Extensions --version 1.0.17                
#r "nuget: D365Extensions, 1.0.17"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install D365Extensions as a Cake Addin
#addin nuget:?package=D365Extensions&version=1.0.17

// Install D365Extensions as a Cake Tool
#tool nuget:?package=D365Extensions&version=1.0.17                

NuGet version (D365Extensions) Build status

D365Extensions

A collection of Extension methods for Microsoft Dynamics CRM/D365 SDK base classes

Setup

All extension methods are declared in the same namespace as related SDK types. No additional using statements required.

Usage

This assembly is assumed to be used for plugin development. As D365 for CE currently doesn't support assembly dependencies you have to merge it in your primary plugin assembly. We recommend using this tool:

ILRepack.Lib.MSBuild.Task

ILRepack use the same technique as ILMerge but it is build on newer versions of Mono instruments so it is more fast and efficient. Please refer to link above for documentation.

After edit you .cproj file should be looking like the folowing:

  <Target Name="AfterBuild">
    <ItemGroup>
      <InputAssemblies Include="$(OutputPath)\$(AssemblyName).dll" />
      <InputAssemblies Include="$(OutputPath)\D365Extensions.dll" />
    </ItemGroup>
    <ILRepack Parallel="true" 
              InputAssemblies="@(InputAssemblies)"
              LibraryPath="$(OutputPath)" 
              KeyFile="$(AssemblyOriginatorKeyFile)" 
              OutputFile="$(OutputPath)\$(AssemblyName).dll" />
  </Target>

You should use KeyFile parameter as your plugin assembly should be signed. We also recommend use LibraryPath parameter as shown to avoid merge problems with dependent SDK assemblies.

!!! Never merge SDK assemblies in your code. It will cause runtime errors !!!

Extensions

Entity Extensions

Set of extension methods for Microsoft.Xrm.Sdk.Entity base class.

GetFormatedValue

Simplifies getting values from Entity.FormattedValues collection

public String GetFormatedValue(String attributeLogicalName);

GetAliasedValue

Simplifies getting values from linked entities attributes wraped in AliasedValue class. This kind of attributes can be queried by FetchExpression or QueryExpression using Linked Entities

public T GetAliasedValue<T>(String attributeLogicalName, String alias);

GetAliasedEntity

Simplifies getting multiple linked entitiy attrubutes by allocating them to separate Entity

public Entity GetAliasedEntity(String entityLogicalName, String alias = null);

GetAliasedEntity<T>

Generic version of GetAliasedEntity

public T GetAliasedEntity<T>(String entityLogicalName, String alias = null) where T : Entity;

MergeAttributes

Add attributes form source Entity if they don't exist in target Entity. Very convenient way to compose attribute values from plugin Target and PreImage to operate single Entity instance.

public void MergeAttributes(Entity source);

IOrganizationService Extensions

Set of extension methods for IOrganizationService base class. Basically these are simple overrides of existing methods which take EntityReference or Entity instead of separate Id and LogicalName parameters.

Associate & Disassociate

Associate & Disassociate methods override. Take EntityReference (insted of separate Id + LogicalName) input parameter

public void Associate(EntityReference primaryEntity, Relationship relationship, EntityReferenceCollection relatedEntities);
public void Associate(EntityReference primaryEntity, Relationship relationship, IList<EntityReference> relatedEntities);

public void Disassociate(EntityReference primaryEntity, Relationship relationship, EntityReferenceCollection relatedEntities);
public void Disassociate(EntityReference primaryEntity, Relationship relationship, IList<EntityReference> relatedEntities)

Delete

Delete method override. Take EntityReference (insted of separate Id + LogicalName) input parameter

public void Delete(EntityReference reference);
public void Delete(Entity entity);

Retrieve

Retrieve method override. Take EntityReference (insted of separate Id + LogicalName) input parameter

public Entity Retrieve(EntityReference reference, ColumnSet columnSet);
public Entity Retrieve(EntityReference reference, params String[] columns);

Retrieve<T>

Generic version of Retrieve

public T Retrieve<T>(EntityReference reference, ColumnSet columnSet) where T : Entity;
public T Retrieve<T>(EntityReference reference, params String[] columns) where T : Entity;

IPluginExecutionContextExtensions Extensions

GetOrganization

Return OrganizationId and OrganizationName fields as single EntityReference

public EntityReference GetOrganization();

GetPrimaryEntity

Return PrimaryEntityId and PrimaryEntityName fields as single EntityReference

public EntityReference GetPrimaryEntity();

GetUser

Return UserId field as EntityReference

public EntityReference GetUser();

GetInitiatingUser

Return InitiatingUserId field as EntityReference

public EntityReference GetInitiatingUser();

GetBusinessUnit

Return BusinessUnitId field as EntityReference

public EntityReference GetBusinessUnit();

GetInputParameter<T>

Gets input paramer

public T GetInputParameter<T>(String name) where T : class;

GetOutputParameter<T>

Gets output paramer

public T GetOutputParameter<T>(String name) where T : class;

GetPreImage

Gets pre image

public Entity GetPreImage(String name);

GetPreImage<T>

Gets pre image as the specified type

public T GetPreImage<T>(String name) where T : Entity;

GetPostImage

Gets post image

public Entity GetPostImage(String name);

GetPostImage<T>

Gets post image as the specified type

public T GetPostImage<T>(String name) where T : Entity;

GetTarget

Shortcut for getting "Target" input parameter of type Entity

public Entity GetTarget();

GetTarget<T>

Shortcut for getting "Target" input parameter as the specified type

public T GetTarget<T>() where T : Entity;

GetPreTarget<T>

Get "Target" entity parameter merged with specified pre image

public T GetPreTarget<T>(String name) where T : Entity;

GetPostTarget<T>

Get "Target" entity parameter merged with specified post image

public T GetPostTarget<T>(String name) where T : Entity;

GetSharedVariable<T>

Gets shared Variable

public T GetSharedVariable<T>(String name) where T : class;

GetRelatedEntitiesByTarget

Simplifies handling of Associate and Disassociate messages. This messages can't be filtered by entity type, furthermore two options possible: when "�" 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);
Product Compatible and additional computed target framework versions.
.NET Framework net452 is compatible.  net46 was computed.  net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
2.1.0 356 5/30/2023
2.0.0 171 5/1/2023
1.5.3 1,583 12/2/2022
1.4.1 13,980 4/15/2022
1.4.0 490 2/7/2022
1.3.0 401 10/15/2021
1.2.1 969 8/19/2020
1.2.0 552 7/19/2020
1.1.0 12,543 8/30/2019
1.0.43 700 7/9/2019
1.0.42 679 6/28/2019
1.0.38 715 6/3/2019
1.0.37 667 5/27/2019
1.0.36 745 4/22/2019
1.0.35 677 4/15/2019
1.0.32 676 3/21/2019
1.0.31 670 3/11/2019
1.0.30 668 3/10/2019
1.0.28 778 2/4/2019
1.0.22 740 1/31/2019
1.0.21 815 12/19/2018
1.0.17 739 12/19/2018
1.0.16 882 10/5/2018
1.0.15 842 10/2/2018
1.0.8 868 10/1/2018
1.0.6 843 9/30/2018