Exemplo n.º 1
0
        /// <summary>
        /// get all data
        /// 得到表中所有数据
        /// </summary>
        /// <returns></returns>
        public IHashTable Data()
        {
            //数据库连接
            if (_connectionConfig.IsAutoCloseConnection == false)
            {
                if (_database.CheckStatus() == false)
                {
                    throw new Exception("databse connect not open");
                }
            }
            if (_connectionConfig.IsAutoCloseConnection == true)
            {
                _database.Open();
            }


            List <Hashtable> hr;

            if (filterDefinition != null)
            {
                hr = _database.GetDataSet(_databasename, _TableName, filterDefinition);
            }
            else
            {
                hr = _database.GetDataSet(_databasename, _TableName, new BsonDocument());
            }

            if (_connectionConfig.IsAutoCloseConnection == true)
            {
                _database.Close();
            }


            IHashTable DT = new IHashTable(hr);

            return(DT);
        }