コード例 #1
0
        internal static string ToText(object rec, ChoJSONRecordConfiguration configuration, Encoding encoding, int bufferSize, TraceSwitch traceSwitch = null)
        {
            ChoJSONRecordWriter writer = new ChoJSONRecordWriter(rec.GetType(), configuration);

            writer.TraceSwitch = traceSwitch == null ? ChoETLFramework.TraceSwitchOff : traceSwitch;

            using (var stream = new MemoryStream())
                using (var reader = new StreamReader(stream))
                    using (var sw = new StreamWriter(stream, configuration.Encoding, configuration.BufferSize))
                    {
                        writer.WriteTo(sw, new object[] { rec }).Loop();
                        sw.Flush();
                        stream.Position = 0;

                        return(reader.ReadToEnd());
                    }
        }
コード例 #2
0
 public void Write(IEnumerable <T> records)
 {
     _writer.Writer      = this;
     _writer.TraceSwitch = TraceSwitch;
     _writer.WriteTo(_textWriter.Value, records.OfType <object>()).Loop();
 }
コード例 #3
0
 public void Write(IEnumerable <T> records)
 {
     _writer.Writer      = this;
     _writer.TraceSwitch = TraceSwitch;
     _writer.WriteTo(_textWriter, records).Loop();
 }