public static async Task <IDataStorage> LoadAsync(IDataStorage dataStorage, DataStorageProperties dataStorageProperties) { PreloadDataStorage preloaded = new PreloadDataStorage(dataStorage); await preloaded.PreloadAsync(dataStorage, dataStorageProperties); return(preloaded); }
private async Task PreloadAsync(IDataStorage dataStorage, DataStorageProperties dataStorageProperties) { if (dataStorageProperties.DoesSupportParallelPreload) { var agenciesTask = dataStorage.GetAgenciesAsync(); var calendarDatesTask = dataStorage.GetCalendarDatesAsync(); var stopsTask = dataStorage.GetStopsAsync(); _agencies = await agenciesTask; _calendarDates = await calendarDatesTask; _stops = await stopsTask; } else { _agencies = await _dataStorage.GetAgenciesAsync(); _calendarDates = await _dataStorage.GetCalendarDatesAsync(); _stops = await _dataStorage.GetStopsAsync(); } }