chore: 调整访问权限

oneRain 2020-05-13 14:14:23 +08:00
parent 8a779af880
commit 8de256993a
5 changed files with 51 additions and 52 deletions

View File

@ -99,9 +99,6 @@
<Compile Include="..\Storage\Internal\Http\LCHttpClient.cs"> <Compile Include="..\Storage\Internal\Http\LCHttpClient.cs">
<Link>Internal\Http\LCHttpClient.cs</Link> <Link>Internal\Http\LCHttpClient.cs</Link>
</Compile> </Compile>
<Compile Include="..\Storage\Internal\Http\LCJsonConverter.cs">
<Link>Internal\Http\LCJsonConverter.cs</Link>
</Compile>
<Compile Include="..\Storage\Internal\Query\LCEqualCondition.cs"> <Compile Include="..\Storage\Internal\Query\LCEqualCondition.cs">
<Link>Internal\Query\LCEqualCondition.cs</Link> <Link>Internal\Query\LCEqualCondition.cs</Link>
</Compile> </Compile>

View File

@ -4,30 +4,30 @@ using System.Collections.Generic;
using LeanCloud.Storage.Internal.Codec; using LeanCloud.Storage.Internal.Codec;
namespace LeanCloud.Storage.Internal.Object { namespace LeanCloud.Storage.Internal.Object {
internal class LCObjectData { public class LCObjectData {
internal string ClassName { public string ClassName {
get; set; get; set;
} }
internal string ObjectId { public string ObjectId {
get; set; get; set;
} }
internal DateTime CreatedAt { public DateTime CreatedAt {
get; set; get; set;
} }
internal DateTime UpdatedAt { public DateTime UpdatedAt {
get; set; get; set;
} }
internal Dictionary<string, object> CustomPropertyDict; public Dictionary<string, object> CustomPropertyDict;
internal LCObjectData() { public LCObjectData() {
CustomPropertyDict = new Dictionary<string, object>(); CustomPropertyDict = new Dictionary<string, object>();
} }
internal static LCObjectData Decode(IDictionary dict) { public static LCObjectData Decode(IDictionary dict) {
if (dict == null) { if (dict == null) {
return null; return null;
} }
@ -50,7 +50,7 @@ namespace LeanCloud.Storage.Internal.Object {
return objectData; return objectData;
} }
internal static Dictionary<string, object> Encode(LCObjectData objectData) { public static Dictionary<string, object> Encode(LCObjectData objectData) {
if (objectData == null) { if (objectData == null) {
return null; return null;
} }

View File

@ -118,7 +118,7 @@ namespace LeanCloud.Storage.Internal.Query {
public void WhereMatchesQuery<K>(string key, LCQuery<K> query) where K : LCObject { public void WhereMatchesQuery<K>(string key, LCQuery<K> query) where K : LCObject {
Dictionary<string, object> inQuery = new Dictionary<string, object> { Dictionary<string, object> inQuery = new Dictionary<string, object> {
{ "where", query.condition }, { "where", query.Condition },
{ "className", query.ClassName } { "className", query.ClassName }
}; };
AddOperation(key, "$inQuery", inQuery); AddOperation(key, "$inQuery", inQuery);
@ -126,7 +126,7 @@ namespace LeanCloud.Storage.Internal.Query {
public void WhereDoesNotMatchQuery<K>(string key, LCQuery<K> query) where K : LCObject { public void WhereDoesNotMatchQuery<K>(string key, LCQuery<K> query) where K : LCObject {
Dictionary<string, object> inQuery = new Dictionary<string, object> { Dictionary<string, object> inQuery = new Dictionary<string, object> {
{ "where", query.condition }, { "where", query.Condition },
{ "className", query.ClassName } { "className", query.ClassName }
}; };
AddOperation(key, "$notInQuery", inQuery); AddOperation(key, "$notInQuery", inQuery);

View File

@ -93,7 +93,7 @@ namespace LeanCloud.Storage {
return obj; return obj;
} }
internal static LCObject Create(string className) { public static LCObject Create(string className) {
if (subclassNameDict.TryGetValue(className, out LCSubclassInfo subclassInfo)) { if (subclassNameDict.TryGetValue(className, out LCSubclassInfo subclassInfo)) {
return subclassInfo.Constructor.Invoke(); return subclassInfo.Constructor.Invoke();
} }
@ -494,7 +494,7 @@ namespace LeanCloud.Storage {
} }
} }
internal void Merge(LCObjectData objectData) { public void Merge(LCObjectData objectData) {
data.ClassName = objectData.ClassName ?? data.ClassName; data.ClassName = objectData.ClassName ?? data.ClassName;
data.ObjectId = objectData.ObjectId ?? data.ObjectId; data.ObjectId = objectData.ObjectId ?? data.ObjectId;
data.CreatedAt = objectData.CreatedAt != null ? objectData.CreatedAt : data.CreatedAt; data.CreatedAt = objectData.CreatedAt != null ? objectData.CreatedAt : data.CreatedAt;

View File

@ -17,11 +17,13 @@ namespace LeanCloud.Storage {
get; private set; get; private set;
} }
internal LCCompositionalCondition condition; public LCCompositionalCondition Condition {
get; internal set;
}
public LCQuery(string className) { public LCQuery(string className) {
ClassName = className; ClassName = className;
condition = new LCCompositionalCondition(); Condition = new LCCompositionalCondition();
} }
/// <summary> /// <summary>
@ -31,7 +33,7 @@ namespace LeanCloud.Storage {
/// <param name="value"></param> /// <param name="value"></param>
/// <returns></returns> /// <returns></returns>
public LCQuery<T> WhereEqualTo(string key, object value) { public LCQuery<T> WhereEqualTo(string key, object value) {
condition.WhereEqualTo(key, value); Condition.WhereEqualTo(key, value);
return this; return this;
} }
@ -42,7 +44,7 @@ namespace LeanCloud.Storage {
/// <param name="value"></param> /// <param name="value"></param>
/// <returns></returns> /// <returns></returns>
public LCQuery<T> WhereNotEqualTo(string key, object value) { public LCQuery<T> WhereNotEqualTo(string key, object value) {
condition.WhereNotEqualTo(key, value); Condition.WhereNotEqualTo(key, value);
return this; return this;
} }
@ -53,7 +55,7 @@ namespace LeanCloud.Storage {
/// <param name="values"></param> /// <param name="values"></param>
/// <returns></returns> /// <returns></returns>
public LCQuery<T> WhereContainedIn(string key, IEnumerable values) { public LCQuery<T> WhereContainedIn(string key, IEnumerable values) {
condition.WhereContainedIn(key, values); Condition.WhereContainedIn(key, values);
return this; return this;
} }
@ -64,7 +66,7 @@ namespace LeanCloud.Storage {
/// <param name="values"></param> /// <param name="values"></param>
/// <returns></returns> /// <returns></returns>
public LCQuery<T> WhereNotContainedIn(string key, IEnumerable values) { public LCQuery<T> WhereNotContainedIn(string key, IEnumerable values) {
condition.WhereNotContainedIn(key, values); Condition.WhereNotContainedIn(key, values);
return this; return this;
} }
@ -75,7 +77,7 @@ namespace LeanCloud.Storage {
/// <param name="values"></param> /// <param name="values"></param>
/// <returns></returns> /// <returns></returns>
public LCQuery<T> WhereContainsAll(string key, IEnumerable values) { public LCQuery<T> WhereContainsAll(string key, IEnumerable values) {
condition.WhereContainsAll(key, values); Condition.WhereContainsAll(key, values);
return this; return this;
} }
@ -85,7 +87,7 @@ namespace LeanCloud.Storage {
/// <param name="key"></param> /// <param name="key"></param>
/// <returns></returns> /// <returns></returns>
public LCQuery<T> WhereExists(string key) { public LCQuery<T> WhereExists(string key) {
condition.WhereExists(key); Condition.WhereExists(key);
return this; return this;
} }
@ -95,7 +97,7 @@ namespace LeanCloud.Storage {
/// <param name="key"></param> /// <param name="key"></param>
/// <returns></returns> /// <returns></returns>
public LCQuery<T> WhereDoesNotExist(string key) { public LCQuery<T> WhereDoesNotExist(string key) {
condition.WhereDoesNotExist(key); Condition.WhereDoesNotExist(key);
return this; return this;
} }
@ -106,7 +108,7 @@ namespace LeanCloud.Storage {
/// <param name="size"></param> /// <param name="size"></param>
/// <returns></returns> /// <returns></returns>
public LCQuery<T> WhereSizeEqualTo(string key, int size) { public LCQuery<T> WhereSizeEqualTo(string key, int size) {
condition.WhereSizeEqualTo(key, size); Condition.WhereSizeEqualTo(key, size);
return this; return this;
} }
@ -117,7 +119,7 @@ namespace LeanCloud.Storage {
/// <param name="value"></param> /// <param name="value"></param>
/// <returns></returns> /// <returns></returns>
public LCQuery<T> WhereGreaterThan(string key, object value) { public LCQuery<T> WhereGreaterThan(string key, object value) {
condition.WhereGreaterThan(key, value); Condition.WhereGreaterThan(key, value);
return this; return this;
} }
@ -128,7 +130,7 @@ namespace LeanCloud.Storage {
/// <param name="value"></param> /// <param name="value"></param>
/// <returns></returns> /// <returns></returns>
public LCQuery<T> WhereGreaterThanOrEqualTo(string key, object value) { public LCQuery<T> WhereGreaterThanOrEqualTo(string key, object value) {
condition.WhereGreaterThanOrEqualTo(key, value); Condition.WhereGreaterThanOrEqualTo(key, value);
return this; return this;
} }
@ -139,7 +141,7 @@ namespace LeanCloud.Storage {
/// <param name="value"></param> /// <param name="value"></param>
/// <returns></returns> /// <returns></returns>
public LCQuery<T> WhereLessThan(string key, object value) { public LCQuery<T> WhereLessThan(string key, object value) {
condition.WhereLessThan(key, value); Condition.WhereLessThan(key, value);
return this; return this;
} }
@ -150,7 +152,7 @@ namespace LeanCloud.Storage {
/// <param name="value"></param> /// <param name="value"></param>
/// <returns></returns> /// <returns></returns>
public LCQuery<T> WhereLessThanOrEqualTo(string key, object value) { public LCQuery<T> WhereLessThanOrEqualTo(string key, object value) {
condition.WhereLessThanOrEqualTo(key, value); Condition.WhereLessThanOrEqualTo(key, value);
return this; return this;
} }
@ -161,7 +163,7 @@ namespace LeanCloud.Storage {
/// <param name="point"></param> /// <param name="point"></param>
/// <returns></returns> /// <returns></returns>
public LCQuery<T> WhereNear(string key, LCGeoPoint point) { public LCQuery<T> WhereNear(string key, LCGeoPoint point) {
condition.WhereNear(key, point); Condition.WhereNear(key, point);
return this; return this;
} }
@ -173,7 +175,7 @@ namespace LeanCloud.Storage {
/// <param name="northeast"></param> /// <param name="northeast"></param>
/// <returns></returns> /// <returns></returns>
public LCQuery<T> WhereWithinGeoBox(string key, LCGeoPoint southwest, LCGeoPoint northeast) { public LCQuery<T> WhereWithinGeoBox(string key, LCGeoPoint southwest, LCGeoPoint northeast) {
condition.WhereWithinGeoBox(key, southwest, northeast); Condition.WhereWithinGeoBox(key, southwest, northeast);
return this; return this;
} }
@ -184,7 +186,7 @@ namespace LeanCloud.Storage {
/// <param name="key"></param> /// <param name="key"></param>
/// <returns></returns> /// <returns></returns>
public LCQuery<T> WhereRelatedTo(LCObject parent, string key) { public LCQuery<T> WhereRelatedTo(LCObject parent, string key) {
condition.WhereRelatedTo(parent, key); Condition.WhereRelatedTo(parent, key);
return this; return this;
} }
@ -195,7 +197,7 @@ namespace LeanCloud.Storage {
/// <param name="prefix"></param> /// <param name="prefix"></param>
/// <returns></returns> /// <returns></returns>
public LCQuery<T> WhereStartsWith(string key, string prefix) { public LCQuery<T> WhereStartsWith(string key, string prefix) {
condition.WhereStartsWith(key, prefix); Condition.WhereStartsWith(key, prefix);
return this; return this;
} }
@ -206,7 +208,7 @@ namespace LeanCloud.Storage {
/// <param name="suffix"></param> /// <param name="suffix"></param>
/// <returns></returns> /// <returns></returns>
public LCQuery<T> WhereEndsWith(string key, string suffix) { public LCQuery<T> WhereEndsWith(string key, string suffix) {
condition.WhereEndsWith(key, suffix); Condition.WhereEndsWith(key, suffix);
return this; return this;
} }
@ -217,7 +219,7 @@ namespace LeanCloud.Storage {
/// <param name="subString"></param> /// <param name="subString"></param>
/// <returns></returns> /// <returns></returns>
public LCQuery<T> WhereContains(string key, string subString) { public LCQuery<T> WhereContains(string key, string subString) {
condition.WhereContains(key, subString); Condition.WhereContains(key, subString);
return this; return this;
} }
@ -229,7 +231,7 @@ namespace LeanCloud.Storage {
/// <param name="modifiers"></param> /// <param name="modifiers"></param>
/// <returns></returns> /// <returns></returns>
public LCQuery<T> WhereMatches(string key, string regex, string modifiers = null) { public LCQuery<T> WhereMatches(string key, string regex, string modifiers = null) {
condition.WhereMatches(key, regex, modifiers); Condition.WhereMatches(key, regex, modifiers);
return this; return this;
} }
@ -240,7 +242,7 @@ namespace LeanCloud.Storage {
/// <param name="query"></param> /// <param name="query"></param>
/// <returns></returns> /// <returns></returns>
public LCQuery<T> WhereMatchesQuery<K>(string key, LCQuery<K> query) where K : LCObject { public LCQuery<T> WhereMatchesQuery<K>(string key, LCQuery<K> query) where K : LCObject {
condition.WhereMatchesQuery(key, query); Condition.WhereMatchesQuery(key, query);
return this; return this;
} }
@ -252,7 +254,7 @@ namespace LeanCloud.Storage {
/// <param name="query"></param> /// <param name="query"></param>
/// <returns></returns> /// <returns></returns>
public LCQuery<T> WhereDoesNotMatchQuery<K>(string key, LCQuery<K> query) where K : LCObject { public LCQuery<T> WhereDoesNotMatchQuery<K>(string key, LCQuery<K> query) where K : LCObject {
condition.WhereDoesNotMatchQuery(key, query); Condition.WhereDoesNotMatchQuery(key, query);
return this; return this;
} }
@ -262,7 +264,7 @@ namespace LeanCloud.Storage {
/// <param name="key"></param> /// <param name="key"></param>
/// <returns></returns> /// <returns></returns>
public LCQuery<T> OrderByAscending(string key) { public LCQuery<T> OrderByAscending(string key) {
condition.OrderByAscending(key); Condition.OrderByAscending(key);
return this; return this;
} }
@ -272,7 +274,7 @@ namespace LeanCloud.Storage {
/// <param name="key"></param> /// <param name="key"></param>
/// <returns></returns> /// <returns></returns>
public LCQuery<T> OrderByDescending(string key) { public LCQuery<T> OrderByDescending(string key) {
condition.OrderByDescending(key); Condition.OrderByDescending(key);
return this; return this;
} }
@ -282,7 +284,7 @@ namespace LeanCloud.Storage {
/// <param name="key"></param> /// <param name="key"></param>
/// <returns></returns> /// <returns></returns>
public LCQuery<T> AddAscendingOrder(string key) { public LCQuery<T> AddAscendingOrder(string key) {
condition.AddAscendingOrder(key); Condition.AddAscendingOrder(key);
return this; return this;
} }
@ -292,7 +294,7 @@ namespace LeanCloud.Storage {
/// <param name="key"></param> /// <param name="key"></param>
/// <returns></returns> /// <returns></returns>
public LCQuery<T> AddDescendingOrder(string key) { public LCQuery<T> AddDescendingOrder(string key) {
condition.AddDescendingOrder(key); Condition.AddDescendingOrder(key);
return this; return this;
} }
@ -302,7 +304,7 @@ namespace LeanCloud.Storage {
/// <param name="key"></param> /// <param name="key"></param>
/// <returns></returns> /// <returns></returns>
public LCQuery<T> Include(string key) { public LCQuery<T> Include(string key) {
condition.Include(key); Condition.Include(key);
return this; return this;
} }
@ -312,7 +314,7 @@ namespace LeanCloud.Storage {
/// <param name="key"></param> /// <param name="key"></param>
/// <returns></returns> /// <returns></returns>
public LCQuery<T> Select(string key) { public LCQuery<T> Select(string key) {
condition.Select(key); Condition.Select(key);
return this; return this;
} }
@ -322,7 +324,7 @@ namespace LeanCloud.Storage {
/// <param name="value"></param> /// <param name="value"></param>
/// <returns></returns> /// <returns></returns>
public LCQuery<T> Skip(int value) { public LCQuery<T> Skip(int value) {
condition.Skip = value; Condition.Skip = value;
return this; return this;
} }
@ -332,7 +334,7 @@ namespace LeanCloud.Storage {
/// <param name="value"></param> /// <param name="value"></param>
/// <returns></returns> /// <returns></returns>
public LCQuery<T> Limit(int value) { public LCQuery<T> Limit(int value) {
condition.Limit = value; Condition.Limit = value;
return this; return this;
} }
@ -396,7 +398,7 @@ namespace LeanCloud.Storage {
throw new Exception("All of the queries in an or query must be on the same class."); throw new Exception("All of the queries in an or query must be on the same class.");
} }
className = query.ClassName; className = query.ClassName;
compositionQuery.condition.Add(query.condition); compositionQuery.Condition.Add(query.Condition);
} }
compositionQuery.ClassName = className; compositionQuery.ClassName = className;
return compositionQuery; return compositionQuery;
@ -407,25 +409,25 @@ namespace LeanCloud.Storage {
throw new ArgumentNullException(nameof(queries)); throw new ArgumentNullException(nameof(queries));
} }
LCQuery<T> compositionQuery = new LCQuery<T>(null); LCQuery<T> compositionQuery = new LCQuery<T>(null);
compositionQuery.condition = new LCCompositionalCondition(LCCompositionalCondition.Or); compositionQuery.Condition = new LCCompositionalCondition(LCCompositionalCondition.Or);
string className = null; string className = null;
foreach (LCQuery<T> query in queries) { foreach (LCQuery<T> query in queries) {
if (className != null && className != query.ClassName) { if (className != null && className != query.ClassName) {
throw new Exception("All of the queries in an or query must be on the same class."); throw new Exception("All of the queries in an or query must be on the same class.");
} }
className = query.ClassName; className = query.ClassName;
compositionQuery.condition.Add(query.condition); compositionQuery.Condition.Add(query.Condition);
} }
compositionQuery.ClassName = className; compositionQuery.ClassName = className;
return compositionQuery; return compositionQuery;
} }
Dictionary<string, object> BuildParams() { Dictionary<string, object> BuildParams() {
return condition.BuildParams(); return Condition.BuildParams();
} }
internal string BuildWhere() { internal string BuildWhere() {
return condition.BuildWhere(); return Condition.BuildWhere();
} }
} }
} }