public virtual async Task SetAsync(ChildQuery query, string key, OfflineEntry entry) { using (var child = query.Child(key)) { if (entry.SyncOptions == SyncOptions.Put) { await child.PutAsync(entry.Data); } else { await child.PatchAsync(entry.Data); } } }
private async Task ResetAfterPull(Task <T> task, string key, OfflineEntry entry) { await task; this.SetAndRaise(key, new OfflineEntry(key, task.Result, entry.Priority, SyncOptions.None), FirebaseEventSource.OnlinePull); }
private void SetAndRaise(string key, OfflineEntry obj, FirebaseEventSource eventSource = FirebaseEventSource.Offline) { this.Database[key] = obj; this.subject.OnNext(new FirebaseEvent <T>(key, obj?.Deserialize <T>(), string.IsNullOrEmpty(obj?.Data) || obj?.Data == "null" ? FirebaseEventType.Delete : FirebaseEventType.InsertOrUpdate, eventSource)); }