public override void Validate(RootElement root) { base.Validate(root); SqlEntityElement foreignEntity = root.FindSqlEntity(this.foreignEntity.Name); if (foreignEntity == null) { root.AddValidationMessage(ParserValidationMessage.NewError(String.Format("Foreign entity ({0}) not found for constraint ({1}).", this.foreignEntity.Name, this.Name))); } else { this.foreignEntity = foreignEntity; ArrayList columns = new ArrayList(); foreach (ColumnElement column in foreignColumns) { ColumnElement columnElement = this.foreignEntity.FindColumnByName(column.Name); if (columnElement == null) { root.AddValidationMessage(ParserValidationMessage.NewError(String.Format("Foreign column ({0}) not found for constraint ({1}).", column.Name, this.Name))); } else { columns.Add(columnElement); } } this.foreignColumns = columns; } }
public override void Validate(RootElement root) { String sort = String.Empty; IList columnMaps = new ArrayList(); foreach (ColumnMapElement columnMap in this.ColumnMaps) { ColumnMapElement columnMapElement = this.entity.FindColumnMap(columnMap.Name); if (columnMapElement == null) { root.AddValidationMessage(ParserValidationMessage.NewError("Finder column element (" + columnMap.Name + ") was not found for entity (" + this.entity.Name + ")")); } else { columnMaps.Add(columnMap); if (!this.sort.Equals(String.Empty)) { sort += ", "; } sort += columnMap.Column.Name; } } if (this.sort.Equals(String.Empty)) { this.sort = sort; } }
public override void Validate(RootElement root) { // Look up the property from the property path. PropertyElement propertyElement = this.dataMap.Entity.FindProperty(this.Name); if (propertyElement == null) { root.AddValidationMessage(ParserValidationMessage.NewError(String.Format("ColumnMap: property ({0}) not found.", this.Name))); } else { this.property = propertyElement; } // Look up the column in the sql entity. ColumnElement columnElement = this.dataMap.SqlEntity.FindColumnByName(this.column.Name); if (columnElement == null) { root.AddValidationMessage(ParserValidationMessage.NewError(String.Format("ColumnMap: column ({0}) not found.", this.column.Name))); } else { this.column = columnElement; // Make sure the column and property types are compatible. // if (!this.property.Type.Equals(String.Empty) && !columnElement.SqlType.Type.Equals(this.property.Type)) { // this.AddValidationMessage(ParserValidationMessage.NewError(String.Format("The type of column ({0}) is ({1}) and is not compatible with the type ({2}) of property ({3}).", this.column.Name, this.column.SqlType.Type, this.Property.Type, this.property.Name))); // } } }
public override void Validate(RootElement root) { // A property should specify either a type or an entity, but not both. // A concrete type should only be declared if a type is declared not if an entity is declared. if (!this.Type.Name.Equals(String.Empty) && !this.EntityType.Name.Equals(String.Empty)) { root.AddValidationMessage(ParserValidationMessage.NewWarning(String.Format("Both a type ({0}) and an entity ({1}) were specified for property ({2})", this.Type.Name, this.entityType.Name, this.Name))); } TypeElement typeElement = root.FindType(this.Type.Name); EntityElement entityType = root.FindEntity(this.EntityType.Name); if (!this.Type.Name.Equals(String.Empty) && typeElement == null) { root.AddValidationMessage(ParserValidationMessage.NewError("Type " + Type.Name + " was not defined")); } else { this.Type = typeElement; } if (this.ConcreteType.Name.Equals(String.Empty)) { this.concreteType = this.Type; } else { TypeElement concreteTypeElement = root.FindType(this.ConcreteType.Name); if (concreteTypeElement == null) { root.AddValidationMessage(ParserValidationMessage.NewError("ConcreteType " + ConcreteType.Name + " was not defined")); } else { this.ConcreteType = concreteTypeElement; } } if (!this.EntityType.Name.Equals(String.Empty) && entityType == null) { root.AddValidationMessage(ParserValidationMessage.NewError("Entity " + EntityType.Name + " was not defined")); } else { this.EntityType = entityType; } if (typeElement == null && entityType == null) { root.AddValidationMessage(ParserValidationMessage.NewError(String.Format("No type or entity was specified for property {0} on entity {1}.", this.Name, this.containingEntity.Name))); } }
public override void Validate(RootElement root) { SqlTypeElement sqlType = root.FindSqlType(this.sqlType.Name); if (sqlType == null) { root.AddValidationMessage(ParserValidationMessage.NewError(String.Format("SqlType ({0}) was not defined [column=({1}.{2})]", this.sqlType.Name, this.sqlEntity, this.Name))); } else { this.sqlType = sqlType; } }
public override void Validate(RootElement root) { if (this.IntegerBased) { foreach (EnumValueElement enumValue in this.values) { try { Int32.Parse(enumValue.Code); } catch { root.AddValidationMessage(ParserValidationMessage.NewError(String.Format("IntegerBased was set for enum {0} and code '{1}' was not parsable by Int32.", this.Name, enumValue.Code))); } } } }
public override void Validate(RootElement root) { // Replace each column placeholder with the column from the sql entity. ArrayList columns = new ArrayList(); foreach (ColumnElement column in this.columns) { ColumnElement columnElement = this.sqlEntity.FindColumnByName(column.Name); if (columnElement == null) { root.AddValidationMessage(ParserValidationMessage.NewError(String.Format("Column specified ({0}) in constraint ({1}) not found as column.", column.Name, this.Name))); } else { columns.Add(columnElement); } } this.columns = columns; }
public override void Validate(RootElement root) { // Find the sql entity. SqlEntityElement sqlEntity = root.FindSqlEntity(this.sqlEntity.Name); if (sqlEntity == null) { root.AddValidationMessage(ParserValidationMessage.NewError(String.Format("Sql Entity ({0}) not found.", this.sqlEntity.Name))); } else { this.sqlEntity = sqlEntity; // Validate each of the column map entries. foreach (ColumnMapElement columnMap in this.columnMaps) { columnMap.Validate(root); } } }
public override void Validate(RootElement root) { // Look up the SQL entity in the database elements. // if (!this.SqlEntity.Name.Equals(String.Empty)) { // SqlEntityElement sqlEntity = RootElement.Instance.FindSqlEntityByName(SqlEntity.Name); // if (sqlEntity == null) { // this.AddValidationMessage(ParserValidationMessage.NewError("sqlentity (" + SqlEntity.Name + ") specified in entity " + Name + " could not be found as an defined sql entity")); // } else { // this.sqlEntity = sqlEntity; // } // } // Look up the base entity in the entity collection. if (!this.BaseEntity.Name.Equals(String.Empty)) { EntityElement baseEntity = root.FindEntity(this.BaseEntity.Name); if (baseEntity == null) { root.AddValidationMessage(ParserValidationMessage.NewError("baseentity (" + BaseEntity.Name + ") specified in entity " + Name + " could not be found as an defined entity (or is defined after this entity in the config file)")); } else { this.baseEntity = baseEntity; } } foreach (PropertyElement property in this.Properties) { property.Validate(root); } foreach (DataMapElement dataMap in this.dataMaps) { dataMap.Validate(root); } foreach (FinderElement finder in this.Finders) { finder.Validate(root); } }
public void AddValidationMessage(ParserValidationMessage message) { this.log.Add(message); }