Esempio n. 1
0
        /// <summary>
        /// 取数据,返回多个结果集的读取方式
        /// </summary>
        /// <typeparam name="T">返回类型</typeparam>
        /// <param name="connString">链接字符串</param>
        /// <param name="proc">存储过程名</param>
        /// <param name="procParams">参数</param>
        /// <param name="readResult">对结果集的处理函数</param>
        /// <returns></returns>
        public static T InnerQueryMultipleProc <T>(String connString, String proc, DynamicParameters procParams, Func <SqlMapper.GridReader, T> readResult)
        {
            IDbConnection conn = null;

            SqlMapper.GridReader reader = null;

            try
            {
                conn = new SqlConnection(connString);

                reader = conn.QueryMultiple(proc, procParams, commandType: CommandType.StoredProcedure);

                return(readResult(reader));
            }
            finally
            {
                if (reader != null)
                {
                    reader.Dispose();
                }
                if (conn != null)
                {
                    conn.Dispose();
                }
            }
        }
Esempio n. 2
0
 public void Dispose()
 {
     if (_reader != null)
     {
         _reader.Dispose();
     }
 }
Esempio n. 3
0
 /// <summary>
 /// Dispose the grid, closing and disposing both the underlying reader and command.
 /// </summary>
 public void Dispose()
 {
     gridReader.Dispose();
     if (transaction == null && connection.State == ConnectionState.Open)
     {
         connection.Close();
     }
 }
Esempio n. 4
0
 public virtual void Dispose() => _gridReader?.Dispose();
 public void Dispose()
 {
     _Reader.Dispose();
 }
Esempio n. 6
0
 public void Dispose()
 {
     _reader?.Dispose();
     GC.SuppressFinalize(this);
 }
Esempio n. 7
0
 public void Dispose()
 {
     gridReader.Dispose();
 }
 public void Dispose()
 {
     _reader.Dispose();
     _connection.Close();
 }