private static IDictionary <int, Type> GetTypeMapping( this GetDataSetResponse self) { return(self.DataTypes.ToDictionary( x => x.Id, x => Type.GetType(x.BclType))); }
private static IEnumerable <DataRow> GetDataRows( this GetDataSetResponse self, DataTable table) { var types = self.GetTypeMapping(); var providers = self.Attributes .OrderBy(x => x.Index) .Select(x => ValueProviders[types[x.DataTypeId]]) .ToArray(); var features = self.AttributeValues .GroupBy(x => x.FeatureIndex); foreach (var f in features) { var row = table.NewRow(); foreach (var v in f) { var i = v.AttributeIndex; row[i] = providers[i](v) ?? DBNull.Value; } yield return(row); } }
public static IFeatureCollection GetFeatureCollection( this GetDataSetResponse self) { return(new FeatureCollection( self.Features, self.GetDataTable())); }
public static IEnumerable <DataColumn> GetDataColumns( this GetDataSetResponse self) { var types = self.DataTypes.ToDictionary( x => x.Id, x => Type.GetType(x.BclType)); return(self.Attributes .OrderBy(x => x.Index) .Select(x => new DataColumn(x.Name, types[x.DataTypeId]))); }
public static DataTable GetDataTable( this GetDataSetResponse self) { var table = new DataTable(); var columns = self.GetDataColumns().ToArray(); table.Columns.AddRange(columns); foreach (var row in self.GetDataRows(table)) { table.Rows.Add(row); } return(table); }