locked
No headers using Filehelpers FileHelperAsyncEngine in C# RRS feed

  • Question

  • Hi, 

    Can't seem to get the FileHelpers library to write headers since switching from FileHelperEngine to FileHelperAsyncEngine. I've called GetFileHeader() as per the docs.

    Any ideas?

    var engine = new FileHelperAsyncEngine<ClaimModel>();
    using (engine.BeginWriteFile(file))
    {
        engine.HeaderText = engine.GetFileHeader();
        foreach (ClaimModel claim in claims)
        {
            engine.WriteNext(Utils.CleanStrings(claim));
        }
     }

    Model

    using FileHelpers;
    using System;
    
    namespace Test1.Console.Models
    {
        [FileHelpers.DelimitedRecord("|")]
        public class ClaimModel : Model
        {
            [FieldQuoted()]
            public string PolicyRef ;
    
            [FieldQuoted()]
            public string Umr ;
    
            [FieldQuoted()]
            [FieldConverter(ConverterKind.Date, "yyyyMMdd HH:mm:ss")]
            public DateTime? InceptionDate ;

    • Moved by CoolDadTx Thursday, March 10, 2016 3:42 PM Third party product
    Thursday, March 10, 2016 2:59 PM

Answers

  • This probably isn't the right forum for questions about 3rd-party tools.

    (However - have you tried setting HeaderText before calling BeginWriteFile()?)

    Thursday, March 10, 2016 3:21 PM

All replies

  • This probably isn't the right forum for questions about 3rd-party tools.

    (However - have you tried setting HeaderText before calling BeginWriteFile()?)

    Thursday, March 10, 2016 3:21 PM
  • This probably isn't the right forum for questions about 3rd-party tools.

    (However - have you tried setting HeaderText before calling BeginWriteFile()?)

    Oh blast, can't believe I missed that.  Yes that's the answer. 

    Thanks :-) 

    Thursday, March 10, 2016 3:47 PM