From 0aab4b959bd9e6d385e2874a475d686cb8bd7c3b Mon Sep 17 00:00:00 2001 From: oneRain Date: Tue, 17 Sep 2019 11:53:28 +0800 Subject: [PATCH] * AVIMConversationQuery.cs: chore * Utils.cs: * FileTest.cs: * JsonTest.cs: * JustTest.cs: * RoleTest.cs: * UserTest.cs: * QueryTest.cs: * AVQuery.cs: * ObjectTest.cs: * RelationTest.cs: * SubClassTest.cs: * AppRouterTest.cs: * CloudFunctionTest.cs: * ObjectControllerTests.cs: * AVObjectController.cs: --- RTM/RTM/Public/AVIMConversationQuery.cs | 24 ++++---------- Storage/Storage.Test/AppRouterTest.cs | 2 +- Storage/Storage.Test/CloudFunctionTest.cs | 2 +- Storage/Storage.Test/FileTest.cs | 2 +- Storage/Storage.Test/JsonTest.cs | 2 +- Storage/Storage.Test/JustTest.cs | 3 +- Storage/Storage.Test/ObjectControllerTests.cs | 2 +- Storage/Storage.Test/ObjectTest.cs | 2 +- Storage/Storage.Test/QueryTest.cs | 3 +- Storage/Storage.Test/RelationTest.cs | 2 +- Storage/Storage.Test/RoleTest.cs | 2 +- Storage/Storage.Test/SubClassTest.cs | 2 +- Storage/Storage.Test/UserTest.cs | 2 +- Storage/Storage.Test/Utils.cs | 2 +- .../Object/Controller/AVObjectController.cs | 2 +- Storage/Storage/Public/AVQuery.cs | 33 ++++--------------- 16 files changed, 28 insertions(+), 59 deletions(-) diff --git a/RTM/RTM/Public/AVIMConversationQuery.cs b/RTM/RTM/Public/AVIMConversationQuery.cs index 287d635..6b1a375 100644 --- a/RTM/RTM/Public/AVIMConversationQuery.cs +++ b/RTM/RTM/Public/AVIMConversationQuery.cs @@ -24,19 +24,7 @@ namespace LeanCloud.Realtime bool compact; bool withLastMessageRefreshed; - private AVIMConversationQuery(AVIMConversationQuery source, - IDictionary where = null, - IEnumerable replacementOrderBy = null, - IEnumerable thenBy = null, - int? skip = null, - int? limit = null, - IEnumerable includes = null, - IEnumerable selectedKeys = null, - string redirectClassNameForKey = null) - : base(source, where, replacementOrderBy, thenBy, skip, limit, includes, selectedKeys, redirectClassNameForKey) - { - - } + /// /// Creates the instance. @@ -108,7 +96,7 @@ namespace LeanCloud.Realtime return cmd; } - public override Task CountAsync(CancellationToken cancellationToken = default) { + public Task CountAsync(CancellationToken cancellationToken = default) { var convCmd = GenerateQueryCommand(); convCmd.Count(); convCmd.Limit(0); @@ -131,7 +119,7 @@ namespace LeanCloud.Realtime /// /// /// - public override Task> FindAsync(CancellationToken cancellationToken = default) + public Task> FindAsync(CancellationToken cancellationToken = default) { var convCmd = this.GenerateQueryCommand().Option("query"); return CurrentClient.RunCommandAsync(convCmd).OnSuccess(t => @@ -156,12 +144,12 @@ namespace LeanCloud.Realtime }); } - public override Task FirstAsync(CancellationToken cancellationToken = default) + public Task FirstAsync(CancellationToken cancellationToken = default) { return this.FirstOrDefaultAsync(); } - public override Task FirstOrDefaultAsync(CancellationToken cancellationToken = default) + public Task FirstOrDefaultAsync(CancellationToken cancellationToken = default) { var firstQuery = this.Limit(1); return firstQuery.FindAsync().OnSuccess(t => @@ -170,7 +158,7 @@ namespace LeanCloud.Realtime }); } - public override Task GetAsync(string objectId, CancellationToken cancellationToken = default) + public Task GetAsync(string objectId, CancellationToken cancellationToken = default) { var idQuery = this.WhereEqualTo("objectId", objectId); return idQuery.FirstAsync(); diff --git a/Storage/Storage.Test/AppRouterTest.cs b/Storage/Storage.Test/AppRouterTest.cs index 9b499bd..05ed299 100644 --- a/Storage/Storage.Test/AppRouterTest.cs +++ b/Storage/Storage.Test/AppRouterTest.cs @@ -2,7 +2,7 @@ using System.Threading.Tasks; using LeanCloud.Storage.Internal; -namespace LeanCloudTests { +namespace LeanCloud.Test { public class AppRouterTest { [Test] public async Task GetServers() { diff --git a/Storage/Storage.Test/CloudFunctionTest.cs b/Storage/Storage.Test/CloudFunctionTest.cs index 90c3363..8683f8c 100644 --- a/Storage/Storage.Test/CloudFunctionTest.cs +++ b/Storage/Storage.Test/CloudFunctionTest.cs @@ -3,7 +3,7 @@ using LeanCloud; using System.Collections.Generic; using System.Threading.Tasks; -namespace LeanCloudTests { +namespace LeanCloud.Test { public class CloudFunctionTest { [SetUp] public void SetUp() { diff --git a/Storage/Storage.Test/FileTest.cs b/Storage/Storage.Test/FileTest.cs index ee073cb..0af4303 100644 --- a/Storage/Storage.Test/FileTest.cs +++ b/Storage/Storage.Test/FileTest.cs @@ -4,7 +4,7 @@ using System.IO; using System.Threading; using System.Threading.Tasks; -namespace LeanCloudTests { +namespace LeanCloud.Test { public class FileTest { string saveFileId; diff --git a/Storage/Storage.Test/JsonTest.cs b/Storage/Storage.Test/JsonTest.cs index 67c0998..d52ddef 100644 --- a/Storage/Storage.Test/JsonTest.cs +++ b/Storage/Storage.Test/JsonTest.cs @@ -5,7 +5,7 @@ using Newtonsoft.Json; using Newtonsoft.Json.Linq; using LeanCloud.Storage.Internal; -namespace LeanCloudTests { +namespace LeanCloud.Test { public class JsonTest { [Test] public void Deserialize() { diff --git a/Storage/Storage.Test/JustTest.cs b/Storage/Storage.Test/JustTest.cs index 4332e9f..e2dca7e 100644 --- a/Storage/Storage.Test/JustTest.cs +++ b/Storage/Storage.Test/JustTest.cs @@ -1,5 +1,6 @@ using System; -namespace Storage.Test { + +namespace LeanCloud.Test { public class JustTest { public class Animal { diff --git a/Storage/Storage.Test/ObjectControllerTests.cs b/Storage/Storage.Test/ObjectControllerTests.cs index c0ded50..e6daea3 100644 --- a/Storage/Storage.Test/ObjectControllerTests.cs +++ b/Storage/Storage.Test/ObjectControllerTests.cs @@ -4,7 +4,7 @@ using System.Threading.Tasks; using System.Collections.Generic; using LeanCloud; -namespace LeanCloudTests { +namespace LeanCloud.Test { public class ObjectControllerTests { [SetUp] public void SetUp() { diff --git a/Storage/Storage.Test/ObjectTest.cs b/Storage/Storage.Test/ObjectTest.cs index 1fd98fa..5416e31 100644 --- a/Storage/Storage.Test/ObjectTest.cs +++ b/Storage/Storage.Test/ObjectTest.cs @@ -3,7 +3,7 @@ using LeanCloud; using System.Threading; using System.Threading.Tasks; -namespace LeanCloudTests { +namespace LeanCloud.Test { public class ObjectTests { [SetUp] public void SetUp() { diff --git a/Storage/Storage.Test/QueryTest.cs b/Storage/Storage.Test/QueryTest.cs index 5b7cb8d..a661cf2 100644 --- a/Storage/Storage.Test/QueryTest.cs +++ b/Storage/Storage.Test/QueryTest.cs @@ -3,9 +3,8 @@ using System.Collections.Generic; using System.Threading.Tasks; using System.Linq; using Newtonsoft.Json; -using LeanCloud; -namespace LeanCloudTests { +namespace LeanCloud.Test { public class QueryTest { [SetUp] public void SetUp() { diff --git a/Storage/Storage.Test/RelationTest.cs b/Storage/Storage.Test/RelationTest.cs index 6cd8982..4640fc9 100644 --- a/Storage/Storage.Test/RelationTest.cs +++ b/Storage/Storage.Test/RelationTest.cs @@ -4,7 +4,7 @@ using System.Threading.Tasks; using System.Collections.Generic; using System.Linq; -namespace LeanCloudTests { +namespace LeanCloud.Test { public class RelationTest { [SetUp] public void SetUp() { diff --git a/Storage/Storage.Test/RoleTest.cs b/Storage/Storage.Test/RoleTest.cs index 27c6347..afa460b 100644 --- a/Storage/Storage.Test/RoleTest.cs +++ b/Storage/Storage.Test/RoleTest.cs @@ -4,7 +4,7 @@ using System.Linq; using System.Threading.Tasks; using LeanCloud; -namespace LeanCloudTests { +namespace LeanCloud.Test { [TestFixture] public class RoleTest { [SetUp] diff --git a/Storage/Storage.Test/SubClassTest.cs b/Storage/Storage.Test/SubClassTest.cs index ca24f1c..aa0255f 100644 --- a/Storage/Storage.Test/SubClassTest.cs +++ b/Storage/Storage.Test/SubClassTest.cs @@ -3,7 +3,7 @@ using LeanCloud; using System.Threading.Tasks; using System.Collections.Generic; -namespace LeanCloudTests { +namespace LeanCloud.Test { [AVClassName("Account")] public class Account : AVObject { [AVFieldName("name")] diff --git a/Storage/Storage.Test/UserTest.cs b/Storage/Storage.Test/UserTest.cs index 4b5b012..5641c58 100644 --- a/Storage/Storage.Test/UserTest.cs +++ b/Storage/Storage.Test/UserTest.cs @@ -5,7 +5,7 @@ using System.Linq; using System; using LeanCloud; -namespace LeanCloudTests { +namespace LeanCloud.Test { public class UserTest { [SetUp] public void SetUp() { diff --git a/Storage/Storage.Test/Utils.cs b/Storage/Storage.Test/Utils.cs index 15135eb..ac12b16 100644 --- a/Storage/Storage.Test/Utils.cs +++ b/Storage/Storage.Test/Utils.cs @@ -2,7 +2,7 @@ using LeanCloud; using NUnit.Framework; -namespace LeanCloudTests { +namespace LeanCloud.Test { public static class Utils { public static void InitNorthChina(bool master = false) { if (master) { diff --git a/Storage/Storage/Internal/Object/Controller/AVObjectController.cs b/Storage/Storage/Internal/Object/Controller/AVObjectController.cs index af0eae4..e9a750f 100644 --- a/Storage/Storage/Internal/Object/Controller/AVObjectController.cs +++ b/Storage/Storage/Internal/Object/Controller/AVObjectController.cs @@ -37,7 +37,7 @@ namespace LeanCloud.Storage.Internal { args.Add("fetchWhenSave", fetchWhenSave); } // 查询条件 - if (query != null && query.condition != null) { + if (query != null) { args.Add("where", query.BuildWhere()); } if (args.Count > 0) { diff --git a/Storage/Storage/Public/AVQuery.cs b/Storage/Storage/Public/AVQuery.cs index 3d2dc91..9f968c1 100644 --- a/Storage/Storage/Public/AVQuery.cs +++ b/Storage/Storage/Public/AVQuery.cs @@ -28,7 +28,10 @@ namespace LeanCloud { } } - internal QueryCompositionalCondition condition; + /// + /// 根查询条件,默认是 and 查询,可以设置为 or 查询 + /// + QueryCompositionalCondition condition; static AVQueryController QueryController { get { @@ -48,7 +51,7 @@ namespace LeanCloud { condition = new QueryCompositionalCondition(); } - #region Composition + #region Compositional Query public static AVQuery And(IEnumerable> queries) { AVQuery composition = new AVQuery(); @@ -123,6 +126,7 @@ namespace LeanCloud { } #region CQL + /// /// 执行 CQL 查询 /// @@ -166,27 +170,6 @@ namespace LeanCloud { #endregion - /// - /// Determines whether the specified object is equal to the current object. - /// - /// The object to compare with the current object. - /// true if the specified object is equal to the current object; otherwise, false - public override bool Equals(object obj) { - if (obj == null || !(obj is AVQuery)) { - return false; - } - - var other = obj as AVQuery; - return ClassName.Equals(other.ClassName) && - condition.Equals(other.condition); - } - - public override int GetHashCode() { - return base.GetHashCode(); - } - - #region Order By - public AVQuery OrderBy(string key) { condition.OrderBy(key); return this; @@ -197,8 +180,6 @@ namespace LeanCloud { return this; } - #endregion - public AVQuery Include(string key) { condition.Include(key); return this; @@ -355,7 +336,7 @@ namespace LeanCloud { #endregion - internal IDictionary BuildParameters(string className = null) { + public IDictionary BuildParameters(string className = null) { return condition.BuildParameters(className); }