Classes and interfaces

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


Teh [TargetFilter] attribute is used in merged-image jummy-jummy interface to state that the property to be registred as a target filter for a plugin step listening for the interface. Target filter basically means, that a method should only be called if at least on of the attributes in an interface marked with the [TargetFilter] decoration.

This information drains all the way into the plugin registration, and ensure tht you update methods will only bee called if at least one of the target filter attributes was actually changed.

Be aware that even though merged images can be used in Create steps, the target has no effect because attribute filtering is only applied on steps that listen to update message.

using Kipon.Xrm.Attributes;

namespace Kipon.PluginExample.Entities
    public partial class Account : Account.IOwnershipLogging
        bool IOwnershipLogging.DescriptionChanged => this.TargetAttributes.ContainsKey(nameof(Description).ToLower());

        public interface IOwnershipLogging : IAccountMergedimage
            Microsoft.Xrm.Sdk.EntityReference OwnerId { get; set; }

            string Description { get; set; }

            bool DescriptionChanged { get; }


Above example interface is using this pattern. It extends the IAccountMergedImage, meaning that any property in the interface, that has a get method, and maps to a property of same name in the underlying entity, that has a [Microsoft.Xrm.Sdk.AttributeLogicalName] decoration will be added to a preimage if used as parameter in a plugin step. All fields with the [TargetFilter] attribute will be added to the target filter on the plugin step.

On runtime, the merged image will contain the accumulated entity. First all preimage attributes will be added to the merged image, and then all target attributes will be added on top. The end result will be a merged image that has values from the target, if the targetpayload contains the field, otherwise it has the prevalue.

Remember that mergedimages can be used as target in validate and pre- state. This means that any change through properties to the merged image entity will drain into the target, and visa-versa.

© Kipon ApS 2020, 2021, 2022, 2023. 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.