* ObjectTest.cs: chore: 移除旧代码
* AVUser.cs: * AVObject.cs: * SubClassTest.cs: * AVExtensions.cs: * AVObjectExtensions.cs: * AVQueryController.cs: * AVObjectController.cs:
parent
a839ccc96d
commit
a9ce795c45
|
@ -178,6 +178,7 @@ namespace LeanCloud.Test {
|
|||
await account.DeleteAsync(condition);
|
||||
|
||||
account = new AVObject("Account") {
|
||||
{ "name", "acl account" },
|
||||
{ "balance", 8 },
|
||||
};
|
||||
account.ACL = new AVACL {
|
||||
|
|
|
@ -38,8 +38,8 @@ namespace LeanCloud.Test {
|
|||
public async Task SubClass() {
|
||||
AVObject.RegisterSubclass<Account>();
|
||||
AVQuery<Account> query = new AVQuery<Account>();
|
||||
IEnumerable<Account> accountList = await query.FindAsync();
|
||||
foreach (Account account in accountList) {
|
||||
IEnumerable<Account> accounts = await query.FindAsync();
|
||||
foreach (Account account in accounts) {
|
||||
Assert.NotNull(account.Name);
|
||||
Assert.Greater(account.Balance, 0);
|
||||
TestContext.Out.WriteLine($"{account.Name}, {account.Balance}");
|
||||
|
|
|
@ -92,12 +92,5 @@ namespace LeanCloud.Storage.Internal {
|
|||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public async Task DeleteAllAsync(IList<IObjectState> states,
|
||||
CancellationToken cancellationToken) {
|
||||
|
||||
// TODO 判断是否全部失败或者网络错误
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,8 +9,7 @@ namespace LeanCloud.Storage.Internal {
|
|||
public class AVQueryController {
|
||||
public async Task<IEnumerable<IObjectState>> FindAsync<T>(AVQuery<T> query, CancellationToken cancellationToken) where T : AVObject {
|
||||
IList<object> items = await FindAsync<IList<object>>(query.Path, query.BuildParameters(), "results", cancellationToken);
|
||||
return from item in items
|
||||
select AVObjectCoder.Instance.Decode(item as IDictionary<string, object>, AVDecoder.Instance);
|
||||
return items.Select(item => AVObjectCoder.Instance.Decode(item as IDictionary<string, object>, AVDecoder.Instance));
|
||||
}
|
||||
|
||||
public async Task<int> CountAsync<T>(AVQuery<T> query, CancellationToken cancellationToken) where T : AVObject {
|
||||
|
|
|
@ -45,11 +45,6 @@ namespace LeanCloud.Storage.Internal
|
|||
return PointerOrLocalIdEncoder.Instance.EncodeAVObject(obj, false);
|
||||
}
|
||||
|
||||
public static void SetIfDifferent<T>(this AVObject obj, string key, T value)
|
||||
{
|
||||
obj.SetIfDifferent<T>(key, value);
|
||||
}
|
||||
|
||||
public static IDictionary<string, object> ServerDataToJSONObjectForSerialization(this AVObject obj)
|
||||
{
|
||||
return obj.ServerDataToJSONObjectForSerialization();
|
||||
|
|
|
@ -18,9 +18,9 @@ namespace LeanCloud {
|
|||
/// </summary>
|
||||
/// <param name="objects">The objects to save.</param>
|
||||
/// <param name="cancellationToken">The cancellation token.</param>
|
||||
public static Task SaveAllAsync<T>(this IEnumerable<T> objects, bool fetchWhenSave = false, AVQuery<AVObject> query = null, CancellationToken cancellationToken = default)
|
||||
public static Task SaveAllAsync<T>(this IEnumerable<T> objects, CancellationToken cancellationToken = default)
|
||||
where T : AVObject {
|
||||
return AVObject.SaveAllAsync(objects, fetchWhenSave, query, cancellationToken);
|
||||
return AVObject.SaveAllAsync(objects, cancellationToken);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -100,25 +100,5 @@ namespace LeanCloud {
|
|||
}
|
||||
return obj.FetchAsyncInternal(queryString, cancellationToken).OnSuccess(t => (T)t.Result);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// If this AVObject has not been fetched (i.e. <see cref="AVObject.IsDataAvailable"/> returns
|
||||
/// false), fetches this object with the data from the server.
|
||||
/// </summary>
|
||||
/// <param name="obj">The AVObject to fetch.</param>
|
||||
public static Task<T> FetchIfNeededAsync<T>(this T obj) where T : AVObject {
|
||||
return obj.FetchIfNeededAsyncInternal(CancellationToken.None).OnSuccess(t => (T)t.Result);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// If this AVObject has not been fetched (i.e. <see cref="AVObject.IsDataAvailable"/> returns
|
||||
/// false), fetches this object with the data from the server.
|
||||
/// </summary>
|
||||
/// <param name="obj">The AVObject to fetch.</param>
|
||||
/// <param name="cancellationToken">The cancellation token.</param>
|
||||
public static Task<T> FetchIfNeededAsync<T>(this T obj, CancellationToken cancellationToken)
|
||||
where T : AVObject {
|
||||
return obj.FetchIfNeededAsyncInternal(cancellationToken).OnSuccess(t => (T)t.Result);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -151,11 +151,9 @@ namespace LeanCloud {
|
|||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public async Task<bool> IsAuthenticatedAsync() {
|
||||
lock (mutex) {
|
||||
if (SessionToken == null || CurrentUser == null || CurrentUser.ObjectId != ObjectId) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
var command = new AVCommand {
|
||||
Path = $"users/me?session_token={SessionToken}",
|
||||
Method = HttpMethod.Get
|
||||
|
|
Loading…
Reference in New Issue