/// <summary> /// Fügt ein Schema hinzu, das bei einer Validierung angewendet wird /// </summary> /// <param name="schemaDatei">Pfad und Name der Schemadatei</param> /// <returns>wahr, falls das Schema erfolgreich geladen werden konnte; falsch sonst, dann Fehler und Warnungen ansehen</returns> public bool SchemaHinzufügen(string schemaDatei) { if (String.IsNullOrEmpty(schemaDatei)) { throw new NullReferenceException("XSD-Datei muss angegeben werden."); } if (!File.Exists(schemaDatei)) { throw new FileNotFoundException("Die XSD-Datei existiert nicht.", schemaDatei); } // Reset the Error/Warning collections Fehler = new List <string>(); Warnungen = new List <string>(); XmlSchema schema; using (var fs = File.OpenRead(schemaDatei)) { schema = XmlSchema.Read(fs, ValidationEventHandler); } var isValid = !Fehler.Any() && !Warnungen.Any(); if (isValid) { Schemata.Add(schema); } return(isValid); }
protected override void LoadTables() { using (DataTable dataTable = sqlConnection.GetSchema(SqlClientMetaDataCollectionNames.Tables, new string[] { null, currentSchemaName, null, "BASE TABLE" })) { foreach (DataRow row in dataTable.Rows) { if (!defaultIgnores.Contains(row["TABLE_NAME"].ToString())) { Schemata schema = SourceSchema.Schemas[currentSchemaName]; schema.Tables.Add(row["TABLE_NAME"].ToString(), new Table() { TableCatalog = row["TABLE_CATALOG"] == DBNull.Value ? null : row["TABLE_CATALOG"].ToString(), TableName = row["TABLE_NAME"] == DBNull.Value ? null : row["TABLE_NAME"].ToString(), TableSchema = row["TABLE_SCHEMA"] == DBNull.Value ? null : row["TABLE_SCHEMA"].ToString(), TableType = row["TABLE_TYPE"] == DBNull.Value ? null : row["TABLE_TYPE"].ToString() }); } } } foreach (Table table in SourceSchema.Schemas[currentSchemaName].Tables.Values) { currentTableName = table.TableName; LoadColumns(); LoadForeignKeys(); LoadIndexes(); //LoadTriggers(); } }