Esempio n. 1
0
        public static Task <List <TRecord> > ReadRecordsAsync <TRecord, TRecordMap>(this ICsvReaderService csvReaderService, string fileName, ICsvContext csvContext = null)
            where TRecordMap : ClassMap, new()
        {
            Argument.IsNotNull(() => csvReaderService);

            if (csvContext == null)
            {
                csvContext = new CsvContext <TRecord, TRecordMap>();
            }

            return(ReadRecordsAsync <TRecord>(csvReaderService, fileName, csvContext));
        }
        public static Task WriteRecordsAsync <TRecord, TRecordMap>(this ICsvWriterService csvWriterService, IEnumerable <TRecord> records, string fileName, ICsvContext csvContext = null)
            where TRecordMap : ClassMap, new()
        {
            Argument.IsNotNull(() => csvWriterService);

            if (csvContext == null)
            {
                csvContext = new CsvContext <TRecord, TRecordMap>();
            }

            return(WriteRecordsAsync(csvWriterService, records, fileName, csvContext));
        }
Esempio n. 3
0
        public static List <TRecord> ReadRecords <TRecord, TRecordMap>(this ICsvReaderService csvReaderService, StreamReader streamReader, ICsvContext csvContext = null)
            where TRecordMap : ClassMap, new()
        {
            Argument.IsNotNull(() => csvReaderService);

            if (csvContext == null)
            {
                csvContext = new CsvContext <TRecord, TRecordMap>();
            }

            return(ReadRecords <TRecord>(csvReaderService, streamReader, csvContext));
        }
Esempio n. 4
0
        public static void WriteRecords <TRecord, TRecordMap>(this ICsvWriterService csvWriterService, IEnumerable <TRecord> records, StreamWriter streamWriter, ICsvContext csvContext = null)
            where TRecordMap : ClassMap, new()
        {
            Argument.IsNotNull(() => csvWriterService);

            if (csvContext == null)
            {
                csvContext = new CsvContext <TRecord, TRecordMap>();
            }

            csvWriterService.WriteRecords(records, streamWriter, csvContext);
        }