public async Task SyncDataBaseAsync(DateTime?createdOrChangedAfter = null) { try { lock (pushing) { Task.Run(() => Client.SyncContext.PushAsync()); } if (createdOrChangedAfter != null) { await SyncTableModel.PullAsync(typeof(TModel).Name, SyncTableModel.Where(x => x.UpdatedAt >= createdOrChangedAfter)); } else { await SyncTableModel.PullAsync(typeof(TModel).Name, SyncTableModel.CreateQuery()); } var list = (await SyncTableModel.ToListAsync()); MergeDictionaries(Cache, (list.Count > 0 ? list.ToDictionary((key) => key.Id, (value) => value) : null)); } catch (Exception err) { Log.Log.Instance.AddLog(err); } }
public async Task <IEnumerable <TModel> > GetByIdsAsync(string[] id) { try { await NeedsRefreshAsync(); return(await SyncTableModel.Where(x => id.Contains(x.Id)).ToEnumerableAsync()); } catch (Exception err) { Log.Log.Instance.AddLog(err); return(null); } }