Ejemplo n.º 1
0
 /// <summary>
 /// Initialize instance of FormatTransformer class for the specified input and output file name.
 /// </summary>
 /// <param name="sourceFilePath"></param>
 /// <param name="outputFilePath"></param>
 public FormatTransformer(string sourceFilePath, string outputFilePath)
 {
     this.sourceFilePath = sourceFilePath;
     this.outputFilePath = outputFilePath;
     readerFactory       = new CsvReaderFactory(this.sourceFilePath);
     writerFactory       = new CsvWriterFactory(this.outputFilePath);
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Initialize instance of FormatTransformer class for default config setting input and output file name.
 /// </summary>
 public FormatTransformer()
 {
     this.sourceFilePath = ConfigurationManager.AppSettings["StandardFileSourcePath"];
     this.outputFilePath = ConfigurationManager.AppSettings["StandardFileOutputPath"];
     readerFactory       = new CsvReaderFactory(this.sourceFilePath);
     writerFactory       = new CsvWriterFactory(this.outputFilePath);
 }
Ejemplo n.º 3
0
 public ModelFolder(IFolder folder, CsvReaderFactory csvReader, ZipFactory zip, SvmFactory svm)
 {
     Folder    = folder;
     CsvReader = csvReader;
     Zip       = zip;
     Svm       = svm;
 }
        private IEnumerable <T> LoadInMemorySet()
        {
            using (var reader = CsvReaderFactory.GetReader(this.File, typeof(T)))
            {
                var records = reader.GetRecords(typeof(T)).Cast <T>().ToArray();

                return(records);
            }
        }
Ejemplo n.º 5
0
        public static ModelBuilder Seed <T, Map>(string filename, ModelBuilder modelBuilder, int?limit = null, bool setIds = false) where T : class, IIdentifier where Map : ClassMap
        {
            var reader = CsvReaderFactory.Create(BasePath);
            var items  = reader.Read <T, Map>(filename).ToList();

            if (limit != null)
            {
                items = items.Take((int)limit).ToList();
            }

            if (setIds)
            {
                Helper.SetModelIds(items);
            }

            modelBuilder.Entity <T>().HasData(items.ToArray());

            return(modelBuilder);
        }
Ejemplo n.º 6
0
 public CsvService(CsvReaderFactory csvFactory)
 {
     this.csvFactory = csvFactory;
 }