예제 #1
0
        public override void Import(string path)
        {
            Parser = _parserFactory.Create <Country>(Provider.GetFirstLine(path));

            LoadData(path);

            var eanCountries = EanCountries.ToArray();

            EanCountries = null;

            var regionsRepository  = FactoryOfRepositories.Regions();
            var regionsEanIdsToIds = regionsRepository.EanIdsToIds;

            regionsEanIdsToIds = ImportRegions(eanCountries, regionsRepository, regionsEanIdsToIds);

            ImportLocalizedRegions(eanCountries, FactoryOfRepositories.Localized <LocalizedRegion>(), regionsEanIdsToIds);

            var typeOfRegionCountryId = FactoryOfRepositories.BaseNames <TypeOfRegion>().GetId("Country");

            ImportRegionsToTypes(eanCountries, FactoryOfRepositories.RegionsToTypes(), regionsEanIdsToIds, typeOfRegionCountryId);

            ImportRegionsToRegions(eanCountries, FactoryOfRepositories.ManyToMany <RegionToRegion>(), regionsEanIdsToIds);

            var countriesRepository = FactoryOfRepositories.AdditionalRegionsInfo <Data.Entity.Country>();

            ImportCountries(eanCountries, countriesRepository, regionsEanIdsToIds);

            ImportProbablyMissingCoutries(ProbablyMissingCoutries, countriesRepository, typeOfRegionCountryId, regionsRepository);
        }
예제 #2
0
        public override void Import(string path)
        {
            LoadData(path);

            var eanIdsToIds = ImportRegions(EanDataTransferObjects, FactoryOfRepositories.Regions(), CreatorId);

            ImportLocalizedRegions(EanDataTransferObjects, FactoryOfRepositories.Localized <LocalizedRegion>(), eanIdsToIds,
                                   DefaultLanguageId, CreatorId);

            ImportRegionsToTypes(EanDataTransferObjects, FactoryOfRepositories.RegionsToTypes(), eanIdsToIds,
                                 FactoryOfRepositories.BaseNames <TypeOfRegion>().GetId("Train Station"),
                                 FactoryOfRepositories.BaseNames <SubClass>().GetId("train"), CreatorId);

            EanDataTransferObjects = null;
        }
예제 #3
0
        public override void Import(string path)
        {
            LoadData(path);

            LogBuild <SubClass>();
            var subClasses = SubClassesNames.Select(s => new SubClass {
                Name = s, CreatorId = CreatorId
            }).ToArray();

            SubClassesNames = null;
            var count = subClasses.Length;

            LogAssembled(count);

            if (count <= 0)
            {
                return;
            }
            LogSave <SubClass>();
            FactoryOfRepositories.BaseNames <SubClass>().BulkSave(subClasses);
            LogSaved <SubClass>();
        }
예제 #4
0
        public override void Import(string path)
        {
            LoadData(path);

            var airportsCoordinates = EanDataTransferObjects.ToArray();

            EanDataTransferObjects = null;

            var regionsEanIdsToIds =
                ImportRegions(airportsCoordinates, FactoryOfRepositories.Regions(), CreatorId);

            ImportLocalizedRegions(airportsCoordinates, FactoryOfRepositories.Localized <LocalizedRegion>(), regionsEanIdsToIds, DefaultLanguageId, CreatorId);

            ImportAirports(airportsCoordinates, FactoryOfRepositories.AdditionalRegionsInfo <Airport>(), regionsEanIdsToIds, CreatorId);

            ImportRegionsToTypes(airportsCoordinates, FactoryOfRepositories.RegionsToTypes(), regionsEanIdsToIds,
                                 FactoryOfRepositories.BaseNames <TypeOfRegion>().GetId("Airport"),
                                 FactoryOfRepositories.BaseNames <SubClass>().GetId("airport"));

            ImpotRegionsToRegions(airportsCoordinates, FactoryOfRepositories.ManyToMany <RegionToRegion>(),
                                  regionsEanIdsToIds, FactoryOfRepositories.AdditionalRegionsInfo <Country>().CodesToIds,
                                  CreatorId);
        }
예제 #5
0
        public override void Import(string path)
        {
            Parser = _parserFactory.Create <ParentRegion>(Provider.GetFirstLine(path));

            LoadData(path);

            var parentRegions = ParentRegions.ToArray();

            const int batchSize = 300000;

            var eanRegionIdsToIds = ImportRegions(parentRegions, FactoryOfRepositories.Regions(), batchSize, CreatorId,
                                                  out var subClassNames);

            var subClasses = ImportSubClasses(FactoryOfRepositories.BaseNames <SubClass>(), subClassNames, CreatorId);

            ImportRegionsToTypes(parentRegions, FactoryOfRepositories.ManyToMany <RegionToType>(), batchSize,
                                 eanRegionIdsToIds, FactoryOfRepositories.BaseNames <TypeOfRegion>().NamesToIds, subClasses, CreatorId);

            ImportLocalized(parentRegions, FactoryOfRepositories.Localized <LocalizedRegion>(), batchSize, eanRegionIdsToIds, DefaultLanguageId, CreatorId);

            ImportRegionsToRegions(parentRegions, FactoryOfRepositories.ManyToMany <RegionToRegion>(), batchSize, eanRegionIdsToIds, CreatorId);

            ParentRegions = null;
        }
예제 #6
0
 public RegionsTypesOfCitiesImporter(IProvider provider, IFactoryOfRepositories factoryOfRepositories, SharedProperties sharedProperties, ILoggingImports logger)
     : base(provider, factoryOfRepositories, sharedProperties, logger)
 {
     TypeOfRegionId = FactoryOfRepositories.BaseNames <TypeOfRegion>().GetId("City");
     SubClassId     = FactoryOfRepositories.BaseNames <SubClass>().GetId("city");
 }
예제 #7
0
 public NeighborhoodsImporter(IProvider provider, IFactoryOfRepositories factoryOfRepositories, SharedProperties sharedProperties, ILoggingImports logger)
     : base(provider, factoryOfRepositories, sharedProperties, logger)
 {
     TypeOfRegionId = FactoryOfRepositories.BaseNames <TypeOfRegion>().GetId("Neighborhood");
     SubClassId     = FactoryOfRepositories.BaseNames <SubClass>().GetId("neighbor");
 }