From afebf7844486844e6515ba627ff1222caf7a2263 Mon Sep 17 00:00:00 2001 From: oneRain Date: Thu, 19 Sep 2019 11:28:47 +0800 Subject: [PATCH] =?UTF-8?q?*=20AVObjectController.cs:=20chore:=20=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D=E4=BF=9D=E5=AD=98=E5=B5=8C=E5=A5=97=20AVObject=20?= =?UTF-8?q?=E7=9A=84=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * AVObject.cs: --- .../Object/Controller/AVObjectController.cs | 1 - Storage/Storage/Public/AVObject.cs | 17 +++++++---------- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/Storage/Storage/Internal/Object/Controller/AVObjectController.cs b/Storage/Storage/Internal/Object/Controller/AVObjectController.cs index e9a750f..865b2f3 100644 --- a/Storage/Storage/Internal/Object/Controller/AVObjectController.cs +++ b/Storage/Storage/Internal/Object/Controller/AVObjectController.cs @@ -3,7 +3,6 @@ using System.Linq; using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; -using LeanCloud.Utilities; using System.Net.Http; namespace LeanCloud.Storage.Internal { diff --git a/Storage/Storage/Public/AVObject.cs b/Storage/Storage/Public/AVObject.cs index b695f92..6c688de 100644 --- a/Storage/Storage/Public/AVObject.cs +++ b/Storage/Storage/Public/AVObject.cs @@ -455,11 +455,8 @@ string propertyName itemsToVisit = dict.Values; } else if (root is IList list) { itemsToVisit = list; - } else if (traverseAVObjects) { - var obj = root as AVObject; - if (obj != null) { - itemsToVisit = obj.Keys.ToList().Select(k => obj[k]); - } + } else if (traverseAVObjects && root is AVObject obj) { + itemsToVisit = obj.Keys.ToList().Select(k => obj[k]); } if (itemsToVisit != null) { foreach (var i in itemsToVisit) { @@ -591,11 +588,11 @@ string propertyName var uniqueObjects = new HashSet(objects, new IdentityEqualityComparer()); // 先保存文件对象(后面可以考虑将 AVFile 作为 AVObject 的子类型进行保存) - var saveDirtyFileTasks = DeepTraversal(obj, true) - .OfType() - .Where(f => f.IsDirty) - .Select(f => f.SaveAsync(cancellationToken: cancellationToken)).ToList(); - await Task.WhenAll(saveDirtyFileTasks); + //var saveDirtyFileTasks = DeepTraversal(obj, true) + // .OfType() + // .Where(f => f.IsDirty) + // .Select(f => f.SaveAsync(cancellationToken: cancellationToken)).ToList(); + //await Task.WhenAll(saveDirtyFileTasks); IEnumerable remaining = new List(uniqueObjects); while (remaining.Any()) {