From 1823dd974bbcae2d6057e43cef0b3983099f47e8 Mon Sep 17 00:00:00 2001 From: oneRain Date: Tue, 17 Sep 2019 16:31:08 +0800 Subject: [PATCH] * QueryCompositionalCondition.cs: chore * QueryEqualCondition.cs: * QueryOperationCondition.cs: --- .../Query/QueryCompositionalCondition.cs | 6 +---- .../Internal/Query/QueryEqualCondition.cs | 4 ++-- .../Internal/Query/QueryOperationCondition.cs | 22 +++++++++---------- 3 files changed, 13 insertions(+), 19 deletions(-) diff --git a/Storage/Storage/Internal/Query/QueryCompositionalCondition.cs b/Storage/Storage/Internal/Query/QueryCompositionalCondition.cs index 5a47a32..f2b87d8 100644 --- a/Storage/Storage/Internal/Query/QueryCompositionalCondition.cs +++ b/Storage/Storage/Internal/Query/QueryCompositionalCondition.cs @@ -222,11 +222,7 @@ namespace LeanCloud.Storage.Internal { } public void AddCondition(string key, string op, object value) { - QueryOperationCondition cond = new QueryOperationCondition { - Key = key, - Op = op, - Value = value - }; + QueryOperationCondition cond = new QueryOperationCondition(key, op, value); AddCondition(cond); } diff --git a/Storage/Storage/Internal/Query/QueryEqualCondition.cs b/Storage/Storage/Internal/Query/QueryEqualCondition.cs index eb08dee..9e9e152 100644 --- a/Storage/Storage/Internal/Query/QueryEqualCondition.cs +++ b/Storage/Storage/Internal/Query/QueryEqualCondition.cs @@ -2,8 +2,8 @@ namespace LeanCloud.Storage.Internal { internal class QueryEqualCondition : IQueryCondition { - string key; - object value; + readonly string key; + readonly object value; public QueryEqualCondition(string key, object value) { this.key = key; diff --git a/Storage/Storage/Internal/Query/QueryOperationCondition.cs b/Storage/Storage/Internal/Query/QueryOperationCondition.cs index 5f52b6e..40c2b2a 100644 --- a/Storage/Storage/Internal/Query/QueryOperationCondition.cs +++ b/Storage/Storage/Internal/Query/QueryOperationCondition.cs @@ -2,29 +2,27 @@ namespace LeanCloud.Storage.Internal { internal class QueryOperationCondition : IQueryCondition { - public string Key { - get; set; - } + readonly string key; + readonly string op; + readonly object value; - public string Op { - get; set; - } - - public object Value { - get; set; + public QueryOperationCondition(string key, string op, object value) { + this.key = key; + this.op = op; + this.value = value; } public bool Equals(IQueryCondition other) { if (other is QueryOperationCondition otherCond) { - return Key == otherCond.Key && Op == otherCond.Op; + return key == otherCond.key && op == otherCond.op; } return false; } public IDictionary ToJSON() { return new Dictionary { - { Key, new Dictionary { - { Op, Value } + { key, new Dictionary { + { op, value } } } }; }