Exemplo n.º 1
0
 public override IGrid ReadGrid(int gridNo)
 {
     try
     {
         using (IDbConnection conn = DbConnectionFactory.CreateDbConnection(_dbConnectionString))
         {
             if (conn == null)//数据库连接已经关闭或链接池没有可用连接
             {
                 return(null);
             }
             conn.Open();
             Envelope  evp  = _gridStateIndicator.GetEnvelope(gridNo);
             Feature[] fets = _reader.Read(evp, conn);
             if (fets != null && fets.Length > 0)
             {
                 foreach (Feature f in fets)
                 {
                     f.SetFeatureClass(_featureClass);
                 }
                 return(new Grid(gridNo, evp, fets));
             }
             return(new Grid(gridNo, evp, null));
         }
     }
     catch (Exception ex)
     {
         Log.WriterException(ex);
         return(null);
     }
 }
Exemplo n.º 2
0
 public Feature[] Read(Envelope envelope)
 {
     if (_reader == null)
     {
         Init();
     }
     if (_reader == null)
     {
         return(null);
     }
     try
     {
         using (IDbConnection dbConn = DbConnectionFactory.CreateDbConnection(_connstring))
         {
             if (dbConn == null)
             {
                 return(null);
             }
             dbConn.Open();
             return(_reader.Read(envelope, dbConn));
         }
     }
     catch (Exception ex)
     {
         Log.WriterException(ex);
         return(null);
     }
 }