WriteRecord() public method

public WriteRecord ( object values ) : void
values object
return void
        /// <summary>
        /// Formats the given object array into an embedded record.
        /// </summary>
        /// <param name="context">Holds information about the column current being processed.</param>
        /// <param name="values">The object array containing the values of the embedded record.</param>
        /// <returns>A formatted string containing the embedded data.</returns>
        protected override string OnFormat(IColumnContext context, object[] values)
        {
            var writer       = new StringWriter();
            var recordWriter = new FixedLengthRecordWriter(writer, schema, Options ?? new FixedLengthOptions());

            recordWriter.WriteRecord(values);
            return(writer.ToString());
        }
Beispiel #2
0
        /// <summary>
        /// Formats the given object array into an embedded record.
        /// </summary>
        /// <param name="value">The object array containing the values of the embedded record.</param>
        /// <returns>A formatted string containing the embedded data.</returns>
        public override string Format(object value)
        {
            object[] values = value as object[];
            if (values == null)
            {
                return(NullHandler.GetNullRepresentation());
            }
            StringWriter            writer       = new StringWriter();
            FixedLengthRecordWriter recordWriter = new FixedLengthRecordWriter(writer, schema, options);

            recordWriter.WriteRecord(values);
            return(writer.ToString());
        }
Beispiel #3
0
        /// <summary>
        /// Formats the given object array into an embedded record.
        /// </summary>
        /// <param name="context">Holds information about the column current being processed.</param>
        /// <param name="value">The object array containing the values of the embedded record.</param>
        /// <returns>A formatted string containing the embedded data.</returns>
        public override string Format(IColumnContext context, object value)
        {
            var values = value as object[];

            if (values == null)
            {
                return(NullHandler.GetNullRepresentation());
            }
            var writer       = new StringWriter();
            var recordWriter = new FixedLengthRecordWriter(writer, schema, Options ?? new FixedLengthOptions());

            recordWriter.WriteRecord(values);
            return(writer.ToString());
        }
 /// <summary>
 /// Writes the textual representation of the given values to the writer.
 /// </summary>
 /// <param name="values">The values to write.</param>
 /// <exception cref="ArgumentNullException">The values array is null.</exception>
 public void Write(object[] values)
 {
     if (values == null)
     {
         throw new ArgumentNullException("values");
     }
     if (isFirstLine)
     {
         if (recordWriter.Options.IsFirstRecordHeader)
         {
             recordWriter.WriteSchema();
             recordWriter.WriteRecordSeparator();
         }
         isFirstLine = false;
     }
     recordWriter.WriteRecord(values);
     recordWriter.WriteRecordSeparator();
 }
Beispiel #5
0
 /// <summary>
 /// Writes the textual representation of the given values to the writer.
 /// </summary>
 /// <param name="values">The values to write.</param>
 /// <exception cref="ArgumentNullException">The values array is null.</exception>
 public void Write(object[] values)
 {
     if (values == null)
     {
         throw new ArgumentNullException(nameof(values));
     }
     if (!isSchemaWritten)
     {
         if (recordWriter.Metadata.ExecutionContext.Options.IsFirstRecordHeader)
         {
             recordWriter.WriteSchema();
             recordWriter.WriteRecordSeparator();
             ++recordWriter.Metadata.PhysicalRecordNumber;
         }
         isSchemaWritten = true;
     }
     recordWriter.WriteRecord(values);
     recordWriter.WriteRecordSeparator();
     ++recordWriter.Metadata.PhysicalRecordNumber;
     ++recordWriter.Metadata.LogicalRecordNumber;
 }
Beispiel #6
0
 /// <summary>
 /// Writes the textual representation of the given values to the writer.
 /// </summary>
 /// <param name="values">The values to write.</param>
 /// <exception cref="ArgumentNullException">The values array is null.</exception>
 public void Write(object[] values)
 {
     if (values == null)
     {
         throw new ArgumentNullException("values");
     }
     if (!isSchemaWritten)
     {
         if (recordWriter.Metadata.Options.IsFirstRecordHeader)
         {
             recordWriter.WriteSchema();
             recordWriter.WriteRecordSeparator();
             ++recordWriter.Metadata.RecordCount;
         }
         isSchemaWritten = true;
     }
     recordWriter.WriteRecord(values);
     recordWriter.WriteRecordSeparator();
     ++recordWriter.Metadata.RecordCount;
     ++recordWriter.Metadata.LogicalRecordCount;
 }
 /// <summary>
 /// Formats the given object array into an embedded record.
 /// </summary>
 /// <param name="value">The object array containing the values of the embedded record.</param>
 /// <returns>A formatted string containing the embedded data.</returns>
 public override string Format(object value)
 {
     object[] values = value as object[];
     if (values == null)
     {
         return NullHandler.GetNullRepresentation();
     }
     StringWriter writer = new StringWriter();
     FixedLengthRecordWriter recordWriter = new FixedLengthRecordWriter(writer, schema, options);
     recordWriter.WriteRecord(values);
     return writer.ToString();
 }