chore: 避免强转空指针

oneRain 2020-05-27 14:33:55 +08:00
parent 5609509e34
commit 66e07a2041
4 changed files with 32 additions and 2 deletions

View File

@ -1,5 +1,6 @@
using NUnit.Framework;
using System.Threading.Tasks;
using System.Collections.ObjectModel;
using LeanCloud;
using LeanCloud.Storage;
@ -74,5 +75,16 @@ namespace Storage.Test {
TestContext.WriteLine(account.ObjectId);
Assert.NotNull(account.ObjectId);
}
[Test]
public async Task Serialization() {
LCQuery<LCObject> query = new LCQuery<LCObject>("Account") {
IncludeACL = true
};
ReadOnlyCollection<LCObject> accounts = await query.Find();
foreach (LCObject account in accounts) {
TestContext.WriteLine(account);
}
}
}
}

View File

@ -24,6 +24,10 @@ namespace LeanCloud.Storage.Internal.Query {
get; set;
}
public bool IncludeACL {
get; set;
}
public LCCompositionalCondition(string composition = And) {
this.composition = composition;
Skip = 0;
@ -217,6 +221,9 @@ namespace LeanCloud.Storage.Internal.Query {
if (selectedKeys != null && selectedKeys.Count > 0) {
dict["keys"] = string.Join(",", selectedKeys);
}
if (IncludeACL) {
dict["returnACL"] = "true";
}
return dict;
}

View File

@ -333,6 +333,17 @@ namespace LeanCloud.Storage {
return this;
}
/// <summary>
/// 是否包含 ACL
/// </summary>
public bool IncludeACL {
get {
return Condition.IncludeACL;
} set {
Condition.IncludeACL = value;
}
}
/// <summary>
/// 跳过
/// </summary>

View File

@ -49,13 +49,13 @@ namespace LeanCloud.Storage {
public bool EmailVerified {
get {
return (bool)this["emailVerified"];
return Convert.ToBoolean(this["emailVerified"]);
}
}
public bool MobileVerified {
get {
return (bool)this["mobilePhoneVerified"];
return Convert.ToBoolean(this["mobilePhoneVerified"]);
}
}