private static async Task StoreData(string ninConnectionString, string urlAlleKoder, string urlVariasjoner, string redList) { var ninMemApiDataLocation = _configuration["NinMemApiData"]; if (!Directory.Exists(ninMemApiDataLocation)) { throw new DirectoryNotFoundException("Directory given in appsettings.json for \"NinMemApiData\" not found"); } var koder = GetKoder(urlAlleKoder, urlVariasjoner); var natureAreas = await DataLoaders.NatureAreas.NatureAreaLoader.Load(ninConnectionString); var descriptionVariables = await DescriptionVariableLoader.Load(ninConnectionString, Codes.Create(koder.variasjonKoder)); var natureAreaTypes = await NatureAreaTypeLoader.Load(ninConnectionString, Codes.Create(koder.alleKoder)); var redlistData = await RedlistLoader.Load(ninConnectionString, redList); var geographicalData = await GeographicalAreaLoader.Load(ninConnectionString); var taxons = TaxonLoader.Get(ninConnectionString); var codetree = new WebClient().DownloadString(_configuration["Kodetre"]); var natureAreaVariables = await NatureAreaVariablesLoader.Load(ninConnectionString); //// TODO: uncomment this when TaxonTraits is back //var taxonTraits = File.ReadAllText("..\\..\\..\\Data\\taxonTraits.json"); var localStorage = new LocalStorage(ninMemApiDataLocation); await Task.WhenAll( localStorage.Store(StorageKeys.NatureAreas, natureAreas), localStorage.Store(StorageKeys.NatureAreaDescriptionVariables, descriptionVariables), localStorage.Store(StorageKeys.NatureAreaTypes, natureAreaTypes), localStorage.Store(StorageKeys.NatureAreaRedlistCategories, redlistData.categories), localStorage.Store(StorageKeys.NatureAreaRedlistThemes, redlistData.themes), localStorage.Store(StorageKeys.NatureAreaGeographicalAreaData, geographicalData), localStorage.Store(StorageKeys.Taxons, taxons.Values.ToList()), localStorage.Store(StorageKeys.CodeTree, codetree), localStorage.Store(StorageKeys.NatureAreaVariables, natureAreaVariables) //// TODO: uncomment this when TaxonTraits is back //localStorage.Store(StorageKeys.TaxonTraits, taxonTraits) ); }
public DefinitionsService() { _defLoader = new DefinitionLoader(this); _propLoader = new PropertyLoader(this); _taxLoader = new TaxonLoader(this); }