public static TableInfo GetTableInfo(this DataColumnCollection columns) { TableInfo res = new TableInfo(null); foreach (DataColumn col in columns.SortedByKey<DataColumn, int>(col => col.Ordinal)) { var commonType = TypeTool.GetCommonType(col.DataType); var colInfo = res.AddColumn(col.ColumnName, commonType.ToString(), TypeTool.GetCommonType(col.DataType)); colInfo.NotNull = !col.AllowDBNull; } return res; }
public static TableInfo GetStructure(bool addFileIdentifier) { var res = new TableInfo(null); res.AddColumn("_ShapeId_", "int", new DbTypeInt()); res.AddColumn("_PartId_", "int", new DbTypeInt()); res.AddColumn("_VertexId_", "int", new DbTypeInt()); res.AddColumn("_X_", "float", new DbTypeFloat()); res.AddColumn("_Y_", "float", new DbTypeFloat()); if (addFileIdentifier) { res.AddColumn("_File_", "nvarchar(250)", new DbTypeString()); } return res; }