/// <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); }
/// <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); }
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); } }
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); }
public CsvService(CsvReaderFactory csvFactory) { this.csvFactory = csvFactory; }