Ejemplo n.º 1
0
        /// <summary>
        /// insert new data
        /// 插入新数据
        /// </summary>
        public void ExecuteCommand()
        {
            //数据库连接
            if (_connectionConfig.IsAutoCloseConnection == false)
            {
                if (_database.CheckStatus() == false)
                {
                    throw new Exception("databse connect not open");
                }
            }
            if (_connectionConfig.IsAutoCloseConnection == true)
            {
                _database.Open();
            }
            _database.InsertData(_databasename, _TableName, MongoDB.Bson.Serialization.BsonSerializer.Deserialize <BsonDocument>(MongoDBOP.HashtableToJson(htData)));

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

            return;
        }