コード例 #1
0
        /// <summary>
        /// Prevent plugin from running multiple times for the same context
        /// </summary>
        public bool IsDuplicatePluginExecution()
        {
            // Delete message can't be called twice so can ignore
            if (Event.MessageName == "Delete")
            {
                return(false);
            }

            var key = $"{PluginTypeName}|{MessageName}|{PipelineStage.ToString()}|{PrimaryEntityId}|{Mode}";

            // Check if key exists in shared variables
            if (this.GetSharedVariable <bool>(key) == true)
            {
                return(true);
            }

            // Add key to shared variables
            SharedVariables.Add(key, true);

            return(false);
        }