コード例 #1
0
        public ImportDataSegmenter(IDataTable table, ColumnMap map)
        {
            Guard.ArgumentNotNull(() => table);
            Guard.ArgumentNotNull(() => map);

            _table     = table;
            _columnMap = map;

            _bof      = true;
            _pageable = new PagedList(0, BATCHSIZE, table.Rows.Count);
            _culture  = CultureInfo.InvariantCulture;
        }
コード例 #2
0
        public override object ConvertFrom(CultureInfo culture, object value)
        {
            if (value is string)
            {
                var dict = JsonConvert.DeserializeObject <Dictionary <string, ColumnMappingItem> >((string)value);
                var map  = new ColumnMap();

                foreach (var kvp in dict)
                {
                    map.AddMapping(kvp.Key, null, kvp.Value.MappedName, kvp.Value.Default);
                }

                return(map);
            }

            return(base.ConvertFrom(culture, value));
        }