chore: 避免强转空指针
parent
5609509e34
commit
66e07a2041
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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"]);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue