public override IExtents GetExtents() { using (IDbConnection conn = DbUtility.CreateConnection(ConnectionString)) using (IDbCommand cmd = DbUtility.CreateCommand()) { conn.Open(); cmd.Connection = conn; cmd.CommandText = String.Format( "SELECT " + "min({0}.ST_MINX(tbl.\"{3}\")) AS xmin, min({0}.ST_MINY(tbl.\"{3}\")) AS ymin, " + "max({0}.ST_MAXX(tbl.\"{3}\")) AS xmax, max({0}.ST_MAXY(tbl.\"{3}\")) AS ymax " + "FROM \"{1}\".\"{2}\" AS tbl;", DB2SpatialExtenderProviderStatic.DefaultSpatialSchema, TableSchema, Table, GeometryColumn); cmd.CommandType = CommandType.Text; using (DB2DataReader r = (DB2DataReader)cmd.ExecuteReader(CommandBehavior.CloseConnection)) { while (r.Read()) { if (r.IsDBNull(0) || r.IsDBNull(1) || r.IsDBNull(2) || r.IsDBNull(3)) { return(GeometryFactory.CreateExtents()); } double xmin = r.GetDouble(0); double ymin = r.GetDouble(1); double xmax = r.GetDouble(2); double ymax = r.GetDouble(3); IExtents ext = GeometryFactory.CreateExtents2D( r.GetDouble(0), r.GetDouble(1), r.GetDouble(2), r.GetDouble(3)); return(ext); } } return(GeometryFactory.CreateExtents()); } }