public bool Validate(ObjectType objectType, string name, ErrorContext errorContext)
        {
            bool result = true;

            if (string.IsNullOrEmpty(name) || name.Length > 256)
            {
                errorContext.Register(this.m_errorCodeNameLength, Severity.Error, objectType, name, "Name", "256");
                result = false;
            }
            if (!NameValidator.IsCLSCompliant(name))
            {
                errorContext.Register(this.m_errorCodeNotCLS, Severity.Error, objectType, name, "Name");
                result = false;
            }
            if (!base.IsUnique(name))
            {
                errorContext.Register(this.m_errorCodeNotUnique, Severity.Error, objectType, name, "Name");
                result = false;
            }
            if (base.IsCaseInsensitiveDuplicate(name))
            {
                errorContext.Register(this.m_errorCodeCaseInsensitiveDuplicate, Severity.Warning, objectType, name, "Name");
            }
            return(result);
        }
 public virtual bool Validate(string name)
 {
     if (NameValidator.IsCLSCompliant(name))
     {
         return(this.IsUnique(name));
     }
     return(false);
 }
Exemplo n.º 3
0
 public static bool ValidateDataElementName(ref string elementName, string defaultName, ObjectType objectType, string objectName, string propertyName, ErrorContext errorContext)
 {
     Global.Tracer.Assert(null != defaultName);
     if (elementName == null)
     {
         elementName = defaultName;
     }
     else if (!NameValidator.IsCLSCompliant(elementName))
     {
         errorContext.Register(ProcessingErrorCode.rsInvalidDataElementNameNotCLSCompliant, Severity.Error, objectType, objectName, null, propertyName, elementName);
         return(false);
     }
     return(true);
 }
Exemplo n.º 4
0
        public override bool Validate(Severity severity, string propertyName, ObjectType objectType, string objectName, string propertyNameValue, ErrorContext errorContext)
        {
            bool result = true;

            if (propertyNameValue == null || !base.IsUnique(propertyNameValue))
            {
                errorContext.Register(ProcessingErrorCode.rsInvalidObjectNameNotUnique, severity, objectType, objectName, propertyName, propertyNameValue);
                result = false;
            }
            if (propertyNameValue != null && !NameValidator.IsCLSCompliant(propertyNameValue))
            {
                errorContext.Register(ProcessingErrorCode.rsInvalidObjectNameNotCLSCompliant, severity, objectType, objectName, propertyName, propertyNameValue);
                result = false;
            }
            return(result);
        }
        public bool Validate(string name, ObjectType objectType, string objectName, ErrorContext errorContext, bool isGrouping, string groupingName)
        {
            bool result = true;

            if (string.IsNullOrEmpty(name) || name.Length > 256)
            {
                if (isGrouping)
                {
                    errorContext.Register(ProcessingErrorCode.rsInvalidGroupingVariableNameLength, Severity.Error, objectType, objectName, "Variable", name, groupingName, "256");
                }
                else
                {
                    errorContext.Register(ProcessingErrorCode.rsInvalidVariableNameLength, Severity.Error, objectType, objectName, "Variable", name, "256");
                }
                result = false;
            }
            if (!NameValidator.IsCLSCompliant(name))
            {
                if (isGrouping)
                {
                    errorContext.Register(ProcessingErrorCode.rsInvalidGroupingVariableNameNotCLSCompliant, Severity.Error, objectType, objectName, "Variable", name, groupingName);
                }
                else
                {
                    errorContext.Register(ProcessingErrorCode.rsInvalidVariableNameNotCLSCompliant, Severity.Error, objectType, objectName, "Variable", name);
                }
                result = false;
            }
            if (!base.IsUnique(name))
            {
                if (isGrouping)
                {
                    errorContext.Register(ProcessingErrorCode.rsDuplicateGroupingVariableName, Severity.Error, objectType, objectName, "Variable", name, groupingName);
                }
                else
                {
                    errorContext.Register(ProcessingErrorCode.rsDuplicateVariableName, Severity.Error, objectType, objectName, "Variable", name);
                }
                result = false;
            }
            return(result);
        }
        public bool Validate(ObjectType objectType, string objectName, ErrorContext errorContext)
        {
            bool result = true;

            if (string.IsNullOrEmpty(objectName) || objectName.Length > 256)
            {
                errorContext.Register(ProcessingErrorCode.rsInvalidDataSourceNameLength, Severity.Error, objectType, objectName, "Name", "256");
                result = false;
            }
            if (!base.IsUnique(objectName))
            {
                errorContext.Register(ProcessingErrorCode.rsDuplicateDataSourceName, Severity.Error, objectType, objectName, "Name");
                result = false;
            }
            if (!NameValidator.IsCLSCompliant(objectName))
            {
                errorContext.Register(ProcessingErrorCode.rsInvalidDataSourceNameNotCLSCompliant, Severity.Error, objectType, objectName, "Name");
                result = false;
            }
            return(result);
        }
        public bool Validate(string name, string dataField, string dataSetName, ErrorContext errorContext)
        {
            bool result = true;

            if (string.IsNullOrEmpty(name) || name.Length > 256)
            {
                errorContext.Register(this.m_errorCodeNameLength, Severity.Error, ObjectType.Field, dataField, "Name", name, dataSetName, "256");
                result = false;
            }
            if (!NameValidator.IsCLSCompliant(name))
            {
                errorContext.Register(this.m_errorCodeNotCLS, Severity.Error, ObjectType.Field, dataField, "Name", name, dataSetName);
                result = false;
            }
            if (!base.IsUnique(name))
            {
                errorContext.Register(this.m_errorCodeNotUnique, Severity.Error, ObjectType.Field, dataField, "Name", name, dataSetName);
                result = false;
            }
            return(result);
        }
Exemplo n.º 8
0
        public bool Validate(bool isGrouping, string scopeName, ObjectType objectType, string objectName, ErrorContext errorContext, bool enforceCLSCompliance)
        {
            bool result = true;

            if (!NameValidator.IsCLSCompliant(scopeName) && enforceCLSCompliance)
            {
                if (isGrouping)
                {
                    errorContext.Register(ProcessingErrorCode.rsInvalidGroupingNameNotCLSCompliant, Severity.Error, objectType, objectName, "Name", scopeName);
                }
                else
                {
                    errorContext.Register(ProcessingErrorCode.rsInvalidNameNotCLSCompliant, Severity.Error, objectType, objectName, "Name");
                }
                result = false;
            }
            if (!base.IsUnique(scopeName))
            {
                errorContext.Register(ProcessingErrorCode.rsDuplicateScopeName, Severity.Error, objectType, objectName, "Name", scopeName);
                result = false;
            }
            return(result);
        }