示例#1
0
        /// <summary>
        /// Saves the specified type of records to the specified repository.
        /// </summary>
        /// <param name="repository">The repository to save to.</param>
        /// <param name="type">The types of records to save.</param>
        public void SaveTo(PafRepository repository, MainfileType type)
        {
            Check.IsNotNull(repository, "repository");

            RecordParser parser = RecordParserFactory.Create(type);

            if (parser != null)
            {
                foreach (MainfileInfo info in this.fileInfos.Where(fi => fi.FileType == type))
                {
                    parser.Parse(info, repository);
                }
            }
        }
示例#2
0
        /// <summary>
        /// Saves all the records to the specified repository.
        /// </summary>
        /// <param name="repository">The repository to save to.</param>
        public void SaveAll(PafRepository repository)
        {
            this.SaveTo(repository, MainfileType.BuildingNames);
            this.SaveTo(repository, MainfileType.BusinessMail);
            this.SaveTo(repository, MainfileType.Localities);
            this.SaveTo(repository, MainfileType.Organisations);
            this.SaveTo(repository, MainfileType.SubBuildingNames);
            this.SaveTo(repository, MainfileType.ThoroughfareDescriptors);
            this.SaveTo(repository, MainfileType.Thoroughfares);

            // These must be saved after the others, as they have foreign keys
            // referencing the above.
            this.SaveTo(repository, MainfileType.Address);
            this.SaveTo(repository, MainfileType.WelshAddress);
        }