/// <summary>
        /// 更新实体
        /// </summary>
        public static async Task <int> UpdateAsync <T>(this DbConnection connection, IEnumerable <T> objList, DbTransaction transaction) where T : BaseEntity
        {
            if (connection == null)
            {
                throw new ArgumentNullException(nameof(connection));
            }
            if (objList == null)
            {
                throw new ArgumentNullException(nameof(objList));
            }
            if (transaction == null)
            {
                throw new ArgumentNullException(nameof(transaction));
            }
            int count = 0;

            using (DbCommand command = connection.CreateCommand())
            {
                command.Transaction = transaction;
                string sql = CodeSegmentHelper.GenerateUpdateSql <T>();
                command.CommandText = sql;
                foreach (var item in objList)
                {
                    if (item != null)
                    {
                        command.Parameters.Clear();
                        command.AppendEntityParameters <T>(item);
                        int result = await command.ExecuteNonQueryAsync();

                        count = result + count;
                    }
                }
            }
            return(count);
        }
 /// <summary>
 /// 更新对象
 /// </summary>
 public static async Task <int> UpdateAsync <T>(this DbConnection connection, T obj, DbTransaction transaction = null) where T : BaseEntity
 {
     if (connection == null)
     {
         throw new ArgumentNullException(nameof(connection));
     }
     if (obj == null)
     {
         throw new ArgumentNullException(nameof(obj));
     }
     using (DbCommand command = connection.CreateCommand())
     {
         if (transaction != null)
         {
             command.Transaction = transaction;
         }
         string sql = CodeSegmentHelper.GenerateUpdateSql <T>();
         command.CommandText = sql;
         command.Parameters.Clear();
         command.AppendEntityParameters <T>(obj);
         return(await command.ExecuteNonQueryAsync());
     }
 }