public override void Validate(DynamicsPluginConfiguration configuration, DynamicsPluginServices services)
 {
     if (!string.IsNullOrEmpty(_imageName))
     {
         if (!services.Context.PostEntityImages.ContainsKey(_imageName))
         {
             Fail($"The plugin '{configuration.PluginType.Name}' must contain a post-entity image named '{_imageName}' to be invoked.");
         }
     }
 }
        public override void Validate(DynamicsPluginConfiguration configuration, DynamicsPluginServices services)
        {
            if (!string.IsNullOrEmpty(_entityName))
            {
                if (((_pluginEntityType & PluginEntityType.Primary) == PluginEntityType.Primary) &&
                    string.Compare(services.Context.PrimaryEntityName, _entityName, true) != 0)
                {
                    Fail($"The plugin '{configuration.PluginType.Name}' must be registered on the entity '{_entityName}' as the primary entity.");
                }

                if (((_pluginEntityType & PluginEntityType.Secondary) == PluginEntityType.Secondary) &&
                    string.Compare(services.Context.SecondaryEntityName, _entityName, true) != 0)
                {
                    Fail($"The plugin '{configuration.PluginType.Name}' must be registered on the entity '{_entityName}' as the secondary entity.");
                }
            }
        }
        public override void Validate(DynamicsPluginConfiguration configuration, DynamicsPluginServices services)
        {
            if (((_configurationType & PluginConfigurationType.Unsecure) == PluginConfigurationType.Unsecure) &&
                string.IsNullOrEmpty(configuration.UnsecureConfiguration))
            {
                Fail($"The plugin '{configuration.PluginType.Name}' must be registered with an unsecure configuration.  You must re-register the plugin with this configuration before you can execute it.");
            }

            if (((_configurationType & PluginConfigurationType.Secure) == PluginConfigurationType.Secure) &&
                string.IsNullOrEmpty(configuration.SecureConfiguration))
            {
                Fail($"The plugin '{configuration.PluginType.Name}' must be registered with a secure configuration.  You must re-register the plugin with this configuration before you can execute it.");
            }

            if (_configurationType == PluginConfigurationType.Both &&
                (string.IsNullOrEmpty(configuration.UnsecureConfiguration) || string.IsNullOrEmpty(configuration.SecureConfiguration)))
            {
                Fail($"The plugin '{configuration.PluginType.Name}' must be registered with both an unsecure and a secure configuration.  You must re-register the plugin with this configuration before you can execute it.");
            }
        }
        public override void Validate(DynamicsPluginConfiguration configuration, DynamicsPluginServices services)
        {
            if ((services.Context.InputParameters == null || !services.Context.InputParameters.Contains("Target")) &&
                _targetType != PluginContextTargetType.None)
            {
                Fail($"The plugin '{configuration.PluginType.Name}' must contain an input parameter named 'Target' to be invoked.");
            }

            if (services.Context.InputParameters != null &&
                services.Context.InputParameters.Contains("Target"))
            {
                if (_targetType == PluginContextTargetType.None)
                {
                    Fail($"The plugin '{configuration.PluginType.Name}' contains an input parameter named 'Target' but it should not.");
                }

                var targetIsEntity          = services.Context.InputParameters["Target"] is Entity;
                var targetIsEntityReference = services.Context.InputParameters["Target"] is EntityReference;

                if (!targetIsEntity &&
                    _targetType == PluginContextTargetType.Entity)
                {
                    Fail($"The plugin '{configuration.PluginType.Name}' contains an input parameter named 'Target' but it's type is not 'Entity'.");
                }

                if (!targetIsEntityReference &&
                    _targetType == PluginContextTargetType.EntityReference)
                {
                    Fail($"The plugin '{configuration.PluginType.Name}' contains an input parameter named 'Target' but it's type is not 'EntityReference'.");
                }

                if (!(targetIsEntity || targetIsEntityReference) &&
                    _targetType == (PluginContextTargetType.Entity | PluginContextTargetType.EntityReference))
                {
                    Fail($"The plugin '{configuration.PluginType.Name}' contains an input parameter named 'Target' but it's type is not 'Entity' or 'EntityReference'.");
                }
            }
        }
Exemplo n.º 5
0
 public abstract void Validate(DynamicsPluginConfiguration configuration, DynamicsPluginServices services);