Classes and interfaces

In this section, each class and interface of the concept will be explained in details.

Kipon.Xrm.Attributes.SortAttribute

If a plugin have several hooks, listening to the same message, in same stage for same entity, you can organize the order of execution these steps by adding the [Sort(N)] decorator.


using Kipon.Xrm.Attributes;

namespace Kipon.PluginExample.Plugins.AttributeExamples
{
    public class SortExamplePlugin : Kipon.Xrm.BasePlugin
    {
        [Sort(1)]
        public void OnPreCreate(Entities.Account.INameChanged target)
        {
            // do something on account according to INameChanged
        }

        [Sort(2)]
        public void OnPreCreate(Entities.Account.IPhoneChanged target)
        {
            // do somethin on account according to IPhoneChanged
        }
    }
}

In above example we have two method listening for pre create message on account. By adding the [Sort] we clearly state witch should be executed first and second

The lowest value a the sort for a Message-Stage-Entity will drain into the plugin registration and be added to the Sort attribute on the Dynamics 365 CE sdkmessagestep definition. That way you can also force a certain order for different plugins listening for the same method,stage,entity event.

© Kipon ApS 2020, 2021, 2022, 2023, 2024. All content on the page is the property of Kipon ApS. Any republish or copy of this content is a violation. The content of this site is NOT open source, and cannot be copied, republished or used in any context without explcit permission from the owner.