public DB2SpatialExtenderProvider(IGeometryFactory geometryFactory, string connectionString, string tableSchema, string tableName, string oidColumn, string geometryColumn) : base( new DB2SpatialExtenderDbUtility(), geometryFactory, connectionString, tableSchema, tableName, oidColumn, geometryColumn) { using (DB2Connection cn = new DB2Connection(connectionString)) { cn.Open(); cn.CacheData = true; try { String selectClause = string.Format( @" SELECT SGC.TYPE_NAME, SGC.SRS_ID FROM {0}.ST_GEOMETRY_COLUMNS AS SGC WHERE (SGC.TABLE_SCHEMA='{1}' AND SGC.TABLE_NAME='{2}' AND SGC.COLUMN_NAME='{3}')", DB2SpatialExtenderProviderStatic.DefaultSpatialSchema, tableSchema, tableName, geometryColumn); DB2DataReader dr = new DB2Command(selectClause, cn).ExecuteReader(); if (dr.HasRows) { dr.Read(); //valid geometry type _validGeometryType = parseGeometryType(dr.GetString(0)); //SrsId DB2SrsId = dr.GetDB2Int32(1).Value; if (!OriginalSpatialReference.EqualParams(GeometryFactory.SpatialReference)) { GeometryFactory.SpatialReference = OriginalSpatialReference; } //OriginalSrid = dr[1].ToString(); if (geometryFactory.Srid == null) { geometryFactory.Srid = OriginalSrid; } else { //geometryFactory.SpatialReference } } else { dr.Close(); selectClause = string.Format(@" SELECT {0}.ST_SRID({1}) FROM {2} AS {3} WHERE ({4}=MIN({4}));", DB2SpatialExtenderProviderStatic.DefaultSpatialSchema, QualifyColumnName(geometryColumn), QualifyTableName(tableSchema, tableName), tableName, QualifyColumnName(oidColumn)); OriginalSrid = ((Int32) new DB2Command(selectClause, cn).ExecuteScalar()).ToString(); _validGeometryType = OgcGeometryType.Geometry; } } catch (Exception) { _validGeometryType = OgcGeometryType.Unknown; } } }