public override void Errors(List <Error> list)
        {
            // Field Name Null or Empty
            if (string.IsNullOrEmpty(this._fieldName))
            {
                list.Add(new ErrorTableRow(this, "Subtype Field names cannot be empty", ErrorType.Error));
            }

            // Get DiagrammerEnvironment Singleton
            DiagrammerEnvironment diagrammerEnvironment = DiagrammerEnvironment.Default;
            SchemaModel           schemaModel           = diagrammerEnvironment.SchemaModel;

            // Get Subtype
            Subtype subtype = (Subtype)this.Table;

            // Get ObjectClass
            ObjectClass objectClass = subtype.GetParent();

            if (objectClass == null)
            {
                // This error is handled by the Subtype class
                return;
            }

            // Get Field
            Field field = objectClass.FindField(this._fieldName);

            if (field == null)
            {
                // Field is missing in parent ObjectClass
                string message = string.Format("The subtype field [{0}] does not exist in the parent objectclass", this._fieldName);
                list.Add(new ErrorTableRow(this, message, ErrorType.Error));
                return;
            }

            // Warning if parent default value and domain are identical
            if (this._defaultValue == field.DefaultValue &&
                this._domainName == field.Domain)
            {
                string message = string.Format("The default values and domain for the subtype field [{0}] are identical to those in the parent objectclass", this._fieldName);
                list.Add(new ErrorTableRow(this, message, ErrorType.Warning));
            }

            // Field can only be small int, long in, single, double, text, date, guid
            switch (field.FieldType)
            {
            case esriFieldType.esriFieldTypeDate:
            case esriFieldType.esriFieldTypeDouble:
            case esriFieldType.esriFieldTypeGUID:
            case esriFieldType.esriFieldTypeInteger:
            case esriFieldType.esriFieldTypeSingle:
            case esriFieldType.esriFieldTypeSmallInteger:
            case esriFieldType.esriFieldTypeString:
                // OK
                break;

            case esriFieldType.esriFieldTypeRaster:
            case esriFieldType.esriFieldTypeBlob:
            case esriFieldType.esriFieldTypeGeometry:
            case esriFieldType.esriFieldTypeOID:
            case esriFieldType.esriFieldTypeGlobalID:
            case esriFieldType.esriFieldTypeXML:
                string message = string.Format("The subtype field [{0}] must use a field of type Date, Double, Guid, Integer, Single, SmallInteger or String", this._fieldName);
                list.Add(new ErrorTableRow(this, message, ErrorType.Error));
                break;
            }

            // Find Domain
            if (!string.IsNullOrEmpty(this._domainName))
            {
                // Get Domain
                Domain domain = schemaModel.FindDomain(this._domainName);

                if (domain == null)
                {
                    // Domain does not exit
                    string message = string.Format("The domain [{0}] for field [{1}] does not exist", this._domainName, field.Name);
                    list.Add(new ErrorTableRow(this, message, ErrorType.Error));
                }
                else
                {
                    // Compare domain and field types
                    if (field.FieldType != domain.FieldType)
                    {
                        string message = string.Format("The field [{0}] and assigned domain [{1}] do not have matching field types.", field.Name, this._domainName);
                        list.Add(new ErrorTableRow(this, message, ErrorType.Error));
                    }

                    // Check Default Value (
                    if (!string.IsNullOrEmpty(this._defaultValue))
                    {
                        string message = null;
                        if (!domain.IsValid(this._defaultValue, out message))
                        {
                            list.Add(new ErrorTableRow(this, message, ErrorType.Warning));
                        }
                    }

                    // Check if a domain value is too long for the text field
                    if (field.FieldType == esriFieldType.esriFieldTypeString &&
                        domain.FieldType == esriFieldType.esriFieldTypeString &&
                        domain.GetType() == typeof(DomainCodedValue))
                    {
                        DomainCodedValue domain2 = (DomainCodedValue)domain;
                        foreach (DomainCodedValueRow x in domain2.CodedValues)
                        {
                            if (string.IsNullOrEmpty(x.Code))
                            {
                                continue;
                            }
                            if (x.Code.Length > field.Length)
                            {
                                string message = string.Format("The domain [{0}] has a value [{1}] that is too long for the field [{2}]", this._domainName, x, this._fieldName);
                                list.Add(new ErrorTableRow(this, message, ErrorType.Error));
                            }
                        }
                    }
                }
            }

            // Check validity of default value against field type
            if (!string.IsNullOrEmpty(this._defaultValue))
            {
                string message;
                if (!GeodatabaseUtility.IsValidateValue(field.FieldType, this._defaultValue, out message))
                {
                    string message2 = string.Format("Default value [{0}] {1}", this._defaultValue, message);
                    list.Add(new ErrorTableRow(this, message2, ErrorType.Error));
                }
            }

            //
            if (!string.IsNullOrEmpty(this._defaultValue))
            {
                if (!string.IsNullOrEmpty(this._domainName))
                {
                    if (!string.IsNullOrEmpty(field.Domain))
                    {
                        if (this._domainName != field.Domain)
                        {
                            Domain domain2 = schemaModel.FindDomain(field.Domain);
                            string message = null;
                            if (!domain2.IsValid(this._defaultValue, out message))
                            {
                                string message2 = string.Format("NIM013605: Field [{0}] - {1}", this._fieldName, message);
                                list.Add(new ErrorTableRow(this, message2, ErrorType.Error));
                            }
                        }
                    }
                }
            }
        }
        public override void Errors(List <Error> list)
        {
            // Get Parent ObjectClass
            ObjectClass objectClass = (ObjectClass)this.Table;

            // Get ObjectClass Fields
            List <Field> fields = objectClass.GetFields();

            // Get Schema Model
            SchemaModel model = (SchemaModel)objectClass.Container;

            // Add GeometryDef Errors
            if (this._geometryDef != null)
            {
                this._geometryDef.Errors(list, (EsriTable)this.Table);
            }

            // GeometryDef only valid for Geometry Fields
            switch (this._fieldType)
            {
            case esriFieldType.esriFieldTypeGeometry:
                if (this._geometryDef == null)
                {
                    list.Add(new ErrorTableRow(this, "Geometry Fields Must have a GeometryDef defined.", ErrorType.Error));
                }
                break;

            case esriFieldType.esriFieldTypeBlob:
            case esriFieldType.esriFieldTypeDate:
            case esriFieldType.esriFieldTypeDouble:
            case esriFieldType.esriFieldTypeGlobalID:
            case esriFieldType.esriFieldTypeGUID:
            case esriFieldType.esriFieldTypeInteger:
            case esriFieldType.esriFieldTypeOID:
            case esriFieldType.esriFieldTypeRaster:
            case esriFieldType.esriFieldTypeSingle:
            case esriFieldType.esriFieldTypeSmallInteger:
            case esriFieldType.esriFieldTypeString:
            case esriFieldType.esriFieldTypeXML:
                if (this._geometryDef != null)
                {
                    list.Add(new ErrorTableRow(this, "Only Geometry Fields can have a GeometryDef defined.", ErrorType.Error));
                }
                break;
            }

            // Raster Fields can have a RasterDef
            switch (this._fieldType)
            {
            case esriFieldType.esriFieldTypeRaster:
                if (this._rasterDef == null)
                {
                    string message = string.Format("The raster field [{0}] does not have a RasterDef assigned", this._name);
                    list.Add(new ErrorTableRow(this, message, ErrorType.Error));
                }
                break;

            case esriFieldType.esriFieldTypeBlob:
            case esriFieldType.esriFieldTypeDate:
            case esriFieldType.esriFieldTypeDouble:
            case esriFieldType.esriFieldTypeGeometry:
            case esriFieldType.esriFieldTypeGUID:
            case esriFieldType.esriFieldTypeInteger:
            case esriFieldType.esriFieldTypeOID:
            case esriFieldType.esriFieldTypeSingle:
            case esriFieldType.esriFieldTypeSmallInteger:
            case esriFieldType.esriFieldTypeString:
            case esriFieldType.esriFieldTypeGlobalID:
            case esriFieldType.esriFieldTypeXML:
                if (this._rasterDef != null)
                {
                    string message = string.Format("The field [{0}] is invalid. Only raster fields can have a RasterDef", this._name);
                    list.Add(new ErrorTableRow(this, message, ErrorType.Error));
                }
                break;
            }

            // Field Name Null or Empty
            if (string.IsNullOrEmpty(this._name))
            {
                list.Add(new ErrorTableRow(this, "Field names cannot be empty", ErrorType.Error));
            }

            // Validate Field Name
            if (!string.IsNullOrEmpty(this._name))
            {
                // Get Validator
                Validator validator = WorkspaceValidator.Default.Validator;
                string    message   = null;
                if (!validator.ValidateFieldName(this._name, out message))
                {
                    string message2 = string.Format("Field [{0}] {1}", this._name, message);
                    list.Add(new ErrorTableRow(this, message2, ErrorType.Error));
                }
            }

            // Alias name more than 255 characters long
            if (!string.IsNullOrEmpty(this._aliasName))
            {
                if (this._aliasName.Length > 255)
                {
                    string message = string.Format("Field [{0}]. Alias name cannot be longer than 255 characters", this._name);
                    list.Add(new ErrorTableRow(this, message, ErrorType.Error));
                }
            }

            // Find Domain
            Domain domain = null;

            if (!string.IsNullOrEmpty(this._domain))
            {
                domain = model.FindDomain(this._domain);

                if (domain == null)
                {
                    // Domain does not exit
                    string message = string.Format("The domain [{0}] for field [{1}] does not exist", this._domain, this._name);
                    list.Add(new ErrorTableRow(this, message, ErrorType.Error));
                }
                else
                {
                    // Compare domain and field types
                    if (this._fieldType != domain.FieldType)
                    {
                        string message = string.Format("The field [{0}] and assigned domain [{1}] do not have matching field types", this._name, this._domain);
                        list.Add(new ErrorTableRow(this, message, ErrorType.Error));
                    }

                    // Check Default Value
                    if (!string.IsNullOrEmpty(this._defaultValue))
                    {
                        string message = null;
                        if (!domain.IsValid(this._defaultValue, out message))
                        {
                            list.Add(new ErrorTableRow(this, message, ErrorType.Warning));
                        }
                    }

                    // Check if a domain value is too long for the text field
                    if (this._fieldType == esriFieldType.esriFieldTypeString &&
                        domain.FieldType == esriFieldType.esriFieldTypeString &&
                        domain.GetType() == typeof(DomainCodedValue))
                    {
                        DomainCodedValue domain2 = (DomainCodedValue)domain;
                        foreach (DomainCodedValueRow x in domain2.CodedValues)
                        {
                            if (string.IsNullOrEmpty(x.Code))
                            {
                                continue;
                            }
                            if (x.Code.Length > this._length)
                            {
                                string message = string.Format("The domain [{0}] has a value [{1}] that is too long for the field [{2}]", this._domain, x, this._name);
                                list.Add(new ErrorTableRow(this, message, ErrorType.Error));
                            }
                        }
                    }
                }
            }

            // Check validity of default value against field type
            if (!string.IsNullOrEmpty(this._defaultValue))
            {
                string message;
                if (!GeodatabaseUtility.IsValidateValue(this._fieldType, this._defaultValue, out message))
                {
                    string message2 = string.Format("Default value '{0}' {1}", this._defaultValue, message);
                    list.Add(new ErrorTableRow(this, message2, ErrorType.Error));
                }
            }

            // Check for unsupported field types
            switch (this._fieldType)
            {
            case esriFieldType.esriFieldTypeBlob:
            case esriFieldType.esriFieldTypeDate:
            case esriFieldType.esriFieldTypeDouble:
            case esriFieldType.esriFieldTypeGeometry:
            case esriFieldType.esriFieldTypeGUID:
            case esriFieldType.esriFieldTypeInteger:
            case esriFieldType.esriFieldTypeOID:
            case esriFieldType.esriFieldTypeRaster:
            case esriFieldType.esriFieldTypeSingle:
            case esriFieldType.esriFieldTypeSmallInteger:
            case esriFieldType.esriFieldTypeString:
            case esriFieldType.esriFieldTypeGlobalID:
                break;

            case esriFieldType.esriFieldTypeXML:
                string message = string.Format("Field type '{0}' is unsupported", this._fieldType.ToString());
                list.Add(new ErrorTableRow(this, message, ErrorType.Error));
                break;
            }

            // Length must be > 0
            if (this._length < 0)
            {
                list.Add(new ErrorTableRow(this, "Field length cannot be less than zero", ErrorType.Error));
            }

            // ModelName cannot be longer than 255 characters
            if (!(string.IsNullOrEmpty(this._modelName)))
            {
                if (this._modelName.Length > 255)
                {
                    list.Add(new ErrorTableRow(this, "Model name cannot be greater than 255 characters long", ErrorType.Error));
                }
            }

            // Precision must be > 0
            if (this._precision < 0)
            {
                list.Add(new ErrorTableRow(this, "Field precision cannot be less than zero", ErrorType.Error));
            }

            // Scale must be > 0
            if (this._scale < 0)
            {
                list.Add(new ErrorTableRow(this, "Field scake cannot be less than zero", ErrorType.Error));
            }

            // IsNullable
            if (this._isNullable)
            {
                switch (this._fieldType)
                {
                case esriFieldType.esriFieldTypeBlob:
                case esriFieldType.esriFieldTypeDate:
                case esriFieldType.esriFieldTypeDouble:
                case esriFieldType.esriFieldTypeGeometry:
                case esriFieldType.esriFieldTypeGUID:
                case esriFieldType.esriFieldTypeInteger:
                case esriFieldType.esriFieldTypeRaster:
                case esriFieldType.esriFieldTypeSingle:
                case esriFieldType.esriFieldTypeSmallInteger:
                case esriFieldType.esriFieldTypeString:
                case esriFieldType.esriFieldTypeXML:
                    break;

                case esriFieldType.esriFieldTypeGlobalID:
                case esriFieldType.esriFieldTypeOID:
                    string message = string.Format("Field type '{0}' cannot have IsNullable = True", this._fieldType.ToString());
                    list.Add(new ErrorTableRow(this, message, ErrorType.Error));
                    break;
                }
            }
        }