protected virtual void LoadSchema() { var dtSchema = TableSchemaManager.GetTableSchema(tableName); this._columns = new ColumnCollection(this); foreach (DataRow row in dtSchema.Rows) { this._columns.Add(new ColumnSchema(row)); } }
public static int WriteSql(this DataTable dt, TextWriter writer, TableName tname) { TableSchemaManager.SetTableSchema(tname, dt); string SQL = tname.GenerateCreateTableClause(appendGO: true); writer.WriteLine(SQL); TableSchema schema = new TableSchema(tname); SqlScriptGeneration gen = new SqlScriptGeneration(SqlScriptType.INSERT, schema); return(gen.GenerateByDbTable(dt, writer)); }