private static GenDataDef ExtractDef(ScanReader reader) { var f = new GenDataDef(); var classId = -1; var className = ""; var token = reader.ScanWhile(ScanReader.Identifier); while (token != "") { switch (token) { case "Definition": reader.ScanWhile(ScanReader.WhiteSpace); if (reader.CheckChar('=')) { reader.SkipChar(); } reader.ScanWhile(ScanReader.WhiteSpace); f.DefinitionName = reader.ScanWhile(ScanReader.QualifiedIdentifier); break; case "Class": reader.ScanWhile(ScanReader.WhiteSpace); if (reader.CheckChar('=')) { reader.SkipChar(); } reader.ScanWhile(ScanReader.WhiteSpace); className = reader.ScanWhile(ScanReader.Identifier); classId = f.AddClass(className); if (f.Classes.Count == 2) { f.AddSubClass("", className); } reader.ScanWhile(ScanReader.WhiteSpace); if (reader.CheckChar('[')) { do { reader.SkipChar(); reader.ScanWhile(ScanReader.WhiteSpace); var inheritorClassName = reader.ScanWhile(ScanReader.Identifier); f.AddInheritor(className, inheritorClassName); reader.ScanWhile(ScanReader.WhiteSpace); } while (reader.CheckChar(',')); Contract.Assert(reader.CheckChar(']'), "Definition Error for class " + className + ": ] expected"); reader.SkipChar(); } break; case "Field": reader.ScanWhile(ScanReader.WhiteSpace); if (reader.CheckChar('=')) { reader.SkipChar(); } if (reader.CheckChar('{')) { do { reader.SkipChar(); reader.ScanWhile(ScanReader.WhiteSpace); var field = reader.ScanWhile(ScanReader.Identifier); f.AddClassInstanceProperty(classId, field); reader.ScanWhile(ScanReader.WhiteSpace); } while (reader.CheckChar(',')); Contract.Assert(reader.CheckChar('}'), "Definition Error for class " + className + " fields list: } expected"); reader.SkipChar(); } else { reader.ScanWhile(ScanReader.WhiteSpace); var field = reader.ScanWhile(ScanReader.Identifier); f.AddClassInstanceProperty(classId, field); } break; case "SubClass": reader.ScanWhile(ScanReader.WhiteSpace); if (reader.CheckChar('=')) { reader.SkipChar(); } if (reader.CheckChar('{')) { while (!reader.CheckChar('}')) { reader.SkipChar(); ParseDefSubClass(reader, f, className); } reader.SkipChar(); } else { ParseDefSubClass(reader, f, className); reader.ScanWhile(ScanReader.WhiteSpace); } break; } reader.ScanWhile(ScanReader.WhiteSpace); token = reader.ScanWhile(ScanReader.Identifier); } return(f); }
public static GenDataDef GetDefinition() { var f = new GenDataDef(); f.DefinitionName = "DatabaseDefinition"; f.AddSubClass("", "Database"); f.AddSubClass("Database", "Schema"); f.AddSubClass("Schema", "Object"); f.AddInheritor("Object", "Table"); f.AddInheritor("Object", "View"); f.AddInheritor("Object", "Procedure"); f.AddInheritor("Object", "Function"); f.AddSubClass("Object", "Column"); f.AddSubClass("Object", "Index"); f.AddSubClass("Object", "ForeignKey"); f.AddSubClass("Object", "Parameter"); f.AddSubClass("Column", "Default"); f.AddSubClass("Index", "KeyColumn"); f.AddSubClass("Index", "DataColumn"); f.AddSubClass("ForeignKey", "ForeignKeyColumn"); f.Classes[1].AddInstanceProperty("Name"); f.Classes[2].AddInstanceProperty("Name"); f.Classes[2].AddInstanceProperty("SchemaName"); f.Classes[3].AddInstanceProperty("Name"); f.Classes[4].AddInstanceProperty("Name"); f.Classes[4].AddInstanceProperty("TableName"); f.Classes[5].AddInstanceProperty("Name"); f.Classes[5].AddInstanceProperty("ViewName"); f.Classes[6].AddInstanceProperty("Name"); f.Classes[6].AddInstanceProperty("ProcedureName"); f.Classes[7].AddInstanceProperty("Name"); f.Classes[7].AddInstanceProperty("FunctionName"); f.Classes[8].AddInstanceProperty("Name"); f.Classes[8].AddInstanceProperty("ColumnName"); f.Classes[8].AddInstanceProperty("NativeDataType"); f.Classes[8].AddInstanceProperty("ODBCDataType"); f.Classes[8].AddInstanceProperty("Length"); f.Classes[8].AddInstanceProperty("Precision"); f.Classes[8].AddInstanceProperty("Scale"); f.Classes[8].AddInstanceProperty("IsNullable"); f.Classes[8].AddInstanceProperty("IsKey"); f.Classes[8].AddInstanceProperty("IsIdentity"); f.Classes[9].AddInstanceProperty("Name"); f.Classes[9].AddInstanceProperty("Value"); f.Classes[10].AddInstanceProperty("Name"); f.Classes[10].AddInstanceProperty("IsPrimaryKey"); f.Classes[10].AddInstanceProperty("IsUnique"); f.Classes[10].AddInstanceProperty("IsClusterKey"); f.Classes[11].AddInstanceProperty("Name"); f.Classes[11].AddInstanceProperty("Order"); f.Classes[12].AddInstanceProperty("Name"); f.Classes[13].AddInstanceProperty("Name"); f.Classes[13].AddInstanceProperty("ReferenceSchema"); f.Classes[13].AddInstanceProperty("ReferenceTable"); f.Classes[13].AddInstanceProperty("DeleteAction"); f.Classes[13].AddInstanceProperty("UpdateAction"); f.Classes[14].AddInstanceProperty("Name"); f.Classes[14].AddInstanceProperty("RelatedColumn"); f.Classes[15].AddInstanceProperty("Name"); f.Classes[15].AddInstanceProperty("ParameterName"); f.Classes[15].AddInstanceProperty("NativeDataType"); f.Classes[15].AddInstanceProperty("ODBCDataType"); f.Classes[15].AddInstanceProperty("Length"); f.Classes[15].AddInstanceProperty("Precision"); f.Classes[15].AddInstanceProperty("Scale"); f.Classes[15].AddInstanceProperty("IsNullable"); f.Classes[15].AddInstanceProperty("Direction"); return(f); }
public static GenDataDef GetDefinition() { var f = new GenDataDef(); f.DefinitionName = "ProfileDefinition"; f.AddSubClass("", "ProfileRoot"); f.AddSubClass("ProfileRoot", "FragmentBody"); f.AddSubClass("FragmentBody", "Fragment"); f.AddInheritor("Fragment", "Null"); f.AddInheritor("Fragment", "Text"); f.AddInheritor("Fragment", "Placeholder"); f.AddInheritor("Fragment", "ContainerFragment"); f.AddInheritor("ContainerFragment", "Profile"); f.AddInheritor("ContainerFragment", "Segment"); f.AddInheritor("ContainerFragment", "Block"); f.AddInheritor("ContainerFragment", "Lookup"); f.AddInheritor("ContainerFragment", "Condition"); f.AddInheritor("ContainerFragment", "Function"); f.AddInheritor("ContainerFragment", "TextBlock"); f.AddInheritor("ContainerFragment", "Annotation"); f.Classes[1].AddInstanceProperty("Name"); f.Classes[1].AddInstanceProperty("Title"); f.Classes[2].AddInstanceProperty("Name"); f.Classes[3].AddInstanceProperty("Name"); f.Classes[4].AddInstanceProperty("Name"); f.Classes[4].AddInstanceProperty("TextValue"); f.Classes[5].AddInstanceProperty("Name"); f.Classes[5].AddInstanceProperty("Class"); f.Classes[5].AddInstanceProperty("Property"); f.Classes[6].AddInstanceProperty("Name"); f.Classes[6].AddInstanceProperty("Primary"); f.Classes[6].AddInstanceProperty("Secondary"); f.Classes[7].AddInstanceProperty("Name"); f.Classes[8].AddInstanceProperty("Name"); f.Classes[8].AddInstanceProperty("Class"); f.Classes[8].AddInstanceProperty("Cardinality"); f.Classes[9].AddInstanceProperty("Name"); f.Classes[10].AddInstanceProperty("Name"); f.Classes[10].AddInstanceProperty("NoMatch"); f.Classes[10].AddInstanceProperty("Class1"); f.Classes[10].AddInstanceProperty("Property1"); f.Classes[10].AddInstanceProperty("Class2"); f.Classes[10].AddInstanceProperty("Property2"); f.Classes[11].AddInstanceProperty("Name"); f.Classes[11].AddInstanceProperty("Class1"); f.Classes[11].AddInstanceProperty("Property1"); f.Classes[11].AddInstanceProperty("Comparison"); f.Classes[11].AddInstanceProperty("Class2"); f.Classes[11].AddInstanceProperty("Property2"); f.Classes[11].AddInstanceProperty("Lit"); f.Classes[11].AddInstanceProperty("UseLit"); f.Classes[12].AddInstanceProperty("Name"); f.Classes[12].AddInstanceProperty("FunctionName"); f.Classes[13].AddInstanceProperty("Name"); f.Classes[14].AddInstanceProperty("Name"); return(f); }