示例#1
0
        private static bool HasPluginHandlerExecutionBeenPreventedInternal(this IPluginExecutionContext context, RegisteredEvent @event, string preventionName)
        {
            var value = context.GetFirstSharedVariable(preventionName);

            if (value == null)
            {
                return(false);
            }

            var hash = ((Entity)value).Attributes;

            return(hash.Contains(string.Empty) ||
                   hash.Contains(GetPreventionRule(@event.MessageName)) ||
                   hash.Contains(GetPreventionRule(@event.MessageName, @event.EntityLogicalName)) ||
                   hash.Contains(GetPreventionRule(@event.MessageName, stage: @event.Stage)) ||
                   hash.Contains(GetPreventionRule(@event.MessageName, @event.EntityLogicalName, @event.Stage)) ||
                   hash.Contains(GetPreventionRule(logicalName: @event.EntityLogicalName)) ||
                   hash.Contains(GetPreventionRule(logicalName: @event.EntityLogicalName, stage: @event.Stage)) ||
                   hash.Contains(GetPreventionRule(stage: @event.Stage)));
        }