Beispiel #1
0
        /// <summary>
        ///     NOT IMPLEMENTED FOR SET STATE
        /// </summary>
        public bool MeetsConditionsChanging(IEnumerable <ConditionExpression> conditions)
        {
            var metPrePlugin  = false;
            var metPostPlugin = false;

            switch (MessageName)
            {
            case PluginMessage.Create:
            {
                metPostPlugin = XrmEntity.MeetsConditions(GetField, conditions);
                break;
            }

            case PluginMessage.Update:
            {
                metPrePlugin  = XrmEntity.MeetsConditions(PreImageEntity.GetFieldDelegate(), conditions);
                metPostPlugin = XrmEntity.MeetsConditions(GetField, conditions);
                break;
            }

            case PluginMessage.Delete:
            {
                metPrePlugin = XrmEntity.MeetsConditions(XrmEntity.GetFieldDelegate(PreImageEntity), conditions);
                break;
            }

            default:
            {
                //not sure what to do for setstate with status
                throw new InvalidPluginExecutionException(
                          "MeetsConditionsChanging Not Implemented for plugin message " + MessageName);
            }
            }
            return(metPostPlugin != metPrePlugin);
        }