Ejemplo n.º 1
0
        public IEnumerator <T> GetEnumerator()
        {
            ChoKVPRecordReader rr = new ChoKVPRecordReader(typeof(T), Configuration);

            rr.Reader                     = this;
            rr.TraceSwitch                = TraceSwitch;
            rr.RowsLoaded                += NotifyRowsLoaded;
            rr.MembersDiscovered         += MembersDiscovered;
            rr.RecordFieldTypeAssessment += RecordFieldTypeAssessment;
            var e = _lines != null?rr.AsEnumerable(_lines).GetEnumerator() : rr.AsEnumerable(_textReader.Value).GetEnumerator();

            return(ChoEnumeratorWrapper.BuildEnumerable <T>(() => e.MoveNext(), () => (T)ChoConvert.ChangeType <ChoRecordFieldAttribute>(e.Current, typeof(T)), () => Dispose()).GetEnumerator());
        }
Ejemplo n.º 2
0
        internal static IEnumerator <object> LoadText(Type recType, string inputText, ChoKVPRecordConfiguration configuration, Encoding encoding, int bufferSize, TraceSwitch traceSwitch = null)
        {
            ChoKVPRecordReader rr = new ChoKVPRecordReader(recType, configuration);

            rr.TraceSwitch = traceSwitch == null ? ChoETLFramework.TraceSwitchOff : traceSwitch;
            return(rr.AsEnumerable(new StreamReader(inputText.ToStream(), encoding, false, bufferSize)).GetEnumerator());
        }
Ejemplo n.º 3
0
        public IDataReader AsDataReader()
        {
            ChoKVPRecordReader rr = new ChoKVPRecordReader(typeof(T), Configuration);

            rr.Reader      = this;
            rr.TraceSwitch = TraceSwitch;
            rr.RowsLoaded += NotifyRowsLoaded;
            var dr = new ChoEnumerableDataReader(rr.AsEnumerable(_textReader), rr);

            return(dr);
        }
Ejemplo n.º 4
0
        public IEnumerator <T> GetEnumerator()
        {
            ChoKVPRecordReader rr = new ChoKVPRecordReader(typeof(T), Configuration);

            rr.Reader      = this;
            rr.TraceSwitch = TraceSwitch;
            rr.RowsLoaded += NotifyRowsLoaded;
            var e = rr.AsEnumerable(_textReader).GetEnumerator();

            return(ChoEnumeratorWrapper.BuildEnumerable <T>(() => e.MoveNext(), () => (T)ChoConvert.ChangeType <ChoRecordFieldAttribute>(e.Current, typeof(T))).GetEnumerator());
        }
Ejemplo n.º 5
0
        private IDataReader AsDataReader(Action <IDictionary <string, Type> > membersDiscovered)
        {
            ChoKVPRecordReader rr = new ChoKVPRecordReader(typeof(T), Configuration);

            rr.Reader             = this;
            rr.TraceSwitch        = TraceSwitch;
            rr.RowsLoaded        += NotifyRowsLoaded;
            rr.MembersDiscovered += membersDiscovered != null ? (o, e) => membersDiscovered(e.Value) : MembersDiscovered;
            var dr = new ChoEnumerableDataReader(rr.AsEnumerable(_textReader), rr);

            return(dr);
        }