oneRain 2020-12-21 14:45:40 +08:00
parent 0b72527130
commit a5997ef463
1 changed files with 2 additions and 10 deletions

View File

@ -346,20 +346,12 @@ namespace LeanCloud.Storage {
return (int)ret["count"]; return (int)ret["count"];
} }
public async Task<T> Get(string objectId) { public Task<T> Get(string objectId) {
if (string.IsNullOrEmpty(objectId)) { if (string.IsNullOrEmpty(objectId)) {
throw new ArgumentNullException(nameof(objectId)); throw new ArgumentNullException(nameof(objectId));
} }
WhereEqualTo("objectId", objectId); WhereEqualTo("objectId", objectId);
Limit(1); return First();
ReadOnlyCollection<T> results = await Find();
if (results != null) {
if (results.Count == 0) {
return null;
}
return results[0];
}
return null;
} }
public async Task<ReadOnlyCollection<T>> Find() { public async Task<ReadOnlyCollection<T>> Find() {