/// <summary>
        /// 封装数据库对象api,内部调用事务
        /// </summary>
        /// <param name="database">数据库对象</param>
        /// <param name="action">运行函数</param>
        public static void Invoke(this Database database, Action <TransactionHost> action)
        {
            using (var host = new TransactionHost(database))
            {
                action?.Invoke(host);

                host.Commit();
            }
        }
        /// <summary>
        /// 封装文档对象api并锁住文档,内部调用事务
        /// </summary>
        /// <param name="document">文档对象</param>
        /// <param name="action">运行函数</param>
        public static void Invoke(this Document document, Action <TransactionHost> action)
        {
            using (document.LockDocument())
            {
                var database = document.Database;

                using (var host = new TransactionHost(database))
                {
                    action?.Invoke(host);

                    host.Commit();
                }
            }
        }