예제 #1
0
        public ListReaderWriter(IEnumerable <T> list, ListReaderWriterOptions options, string destinationTablename, IDictionary <string, string> mappings)
        {
            _List      = list;
            _Options   = options;
            _Tablename = destinationTablename;
            _Mappings  = mappings;

            var q = from x in typeof(T).GetProperties()
                    where _ScalarTypes.Contains(x.PropertyType) && x.CanRead
                    select new Field <T>(x);
            List <Field <T> > l = new List <Field <T> >();

            foreach (var x in typeof(T).GetProperties())
            {
                if (_ScalarTypes.Contains(x.PropertyType) && x.CanRead)
                {
                    l.Add(new Field <T>(x));
                }
            }

            FieldCollection c = new FieldCollection();

            foreach (var item in q)
            {
                if (_Mappings != null && _Mappings.ContainsKey(item.Name))
                {
                    item.Target = _Mappings[item.Name];
                }
                else
                {
                    item.Target = item.Name;
                }
                _Fields.Add(item);
            }
        }
예제 #2
0
 public ListReaderWriter(IEnumerable <T> list, ListReaderWriterOptions options, string destinationTablename)
     : this(list, options, destinationTablename, null)
 {
 }
예제 #3
0
 public ListReaderWriter(IEnumerable <T> list, ListReaderWriterOptions options)
     : this(list, options, "")
 {
 }