Exemple #1
0
        private void ValidateNamespace(ValidationContext context)
        {
            Debug.WriteLine("ConfigurationSection.ValidateNamespace called for " + this.Namespace);  // CALLED!
            string msg = "";

            if (!NamingHelper.TryValidateNamespace(this, this.Name, this.Namespace, NamingHelper.ValidationOptions.None, out msg))
            {
                context.LogError(msg, "InvalidProperty", this);
            }
        }
        private void ValidateNamespace(ValidationContext context)
        {
            Debug.WriteLine("TypeDefinition.ValidateNamespace called for " + this.Namespace);  // CALLED!
            string msg = "";

            if (!NamingHelper.TryValidateNamespace(this, this.Name, this.Namespace, NamingHelper.ValidationOptions.IsRequired, out msg))
            {
                context.LogError(msg, "RequiredProperty", this);
            }
        }
        private void ValidateNamespaces(ValidationContext context)
        {
            Debug.WriteLine("ConfigurationSectionModel.ValidateNamespaces called."); // CALLED!
            string msg = "";

            if (!NamingHelper.TryValidateNamespace(this, "CSD Model", this.Namespace, NamingHelper.ValidationOptions.IsRequired, out msg))
            {
                context.LogError(msg, "InvalidProperty", this);
            }

            if (!NamingHelper.TryValidateNamespace(this, "CSD Model", this.XmlSchemaNamespace, NamingHelper.ValidationOptions.IsRequired | NamingHelper.ValidationOptions.IsXml, out msg))
            {
                context.LogError(msg, "InvalidProperty", this);
            }

            /*
             * if (string.IsNullOrEmpty(this.Namespace))
             * {
             *  context.LogError("The Namespace is required and cannot be an empty string.", "RequiredProperty", this);
             * }
             * // TODO: We are allowed to have start with config here!!!! Fix!!!
             *
             * if (!NamingHelper.IsValidName(this.Namespace))
             * {
             *  context.LogError(Resources.Error_InvalidNamespace, "RequiredProperty", this); // DIES HERE.
             * }
             * if (string.IsNullOrEmpty(this.XmlSchemaNamespace))
             * {
             *  context.LogError("The XML Schema Namespace is required and cannot be an empty string.", "RequiredProperty", this);
             * }
             * if (!NamingHelper.IsValidXmlName(this.XmlSchemaNamespace))
             * {
             *  context.LogError(Resources.Error_InvalidXmlNamespace, "RequiredProperty", this);
             * }
             */
        }