public async Task <bool> IsDocumentEmptyAsync(string documentPath) { var document = FirestoreClient.Document(documentPath); var snapshot = await document.GetSnapshotAsync(); return(!snapshot.Exists || snapshot.ToDictionary().Count == 0); }
public void CreateListener(ConfigurationLevels level, string documentPath, Func <ConfigurationLevels, string, Task> LoadOnChangeAsyncCallback) { var document = FirestoreClient.Document(documentPath); ConfigurationDocuments.Add(level, document); document.Listen(async snapshot => await LoadOnChangeAsyncCallback(level, snapshot.Id)); }
public void CreateListeners(Func <ConfigurationLevels, string, Task> loadOnChangeAsyncCallback) { ConfigurationDocuments.Add(ConfigurationLevels.Application, FirestoreClient.Document(_options.GetApplicationDocumentPath())); ConfigurationDocuments.Add(ConfigurationLevels.Stage, FirestoreClient.Document(_options.GetStageDocumentPath())); ConfigurationDocuments.Add(ConfigurationLevels.Tag, FirestoreClient.Document(_options.GetTagDocumentPath())); ConfigurationDocuments.ToList().ForEach(d => ConfigurationListeners.Add(d.Key, d.Value.Listen(async snapshot => { await loadOnChangeAsyncCallback(d.Key, snapshot.Reference.Path); })) ); }
public async Task SaveAsync(string documentPath, Dictionary <string, object> documentFields) { var document = FirestoreClient.Document(documentPath); await document.SetAsync(documentFields); }