I'm trying to read a flat file and do some processes. To do that I've defined a mapper. That mapper will assign the values for each property. In the document, the date will be represented with yyMMdd format and it can have "" or 000000 as a null value. That mean, if the date is 6 zeros or 6 blank spaces, the output should be null. I tried to do this by defining a NullFormater. But didn't work.
This is what I've tried:
============================
public class Test : DocumentRecordBase
{
public string StorageOrganisation { get; set; }
public Guid? StorageOrganisationId { get; set; }
public string StorageDescription { get; set; }
public DateTime? PaymentDueDate { get; set; }
public decimal? DiscountRate { get; set; }
public int? MaximumDaysDiscount { get; set; }
public DateTime? DateStorageChargeCommences { get; set; }
public decimal? StorageChargePerBalePerDay { get; set; }
public decimal? PenaltyInterestRate { get; set; }
public DateTime? LotAvailableDate { get; set; }
public decimal? PostSaleRechargeRebate { get; set; }
public Test() : base()
{
}
    public override T GetDocumentRecord<T>()
    {
        if (typeof(T) == typeof(Test))
        {
            return this as T;
        }
        return null;
    }
    public static IFixedLengthTypeMapper<Test> GetMapper()
    {
        var mapper = FixedLengthTypeMapper.Define<Test>();
        mapper.Property(r => r.RecordType, 2);
        mapper.Property(r => r.RecordSubType, 1);
        mapper.Property(r => r.PaymentDueDate, 6)
            .ColumnName("PaymentDueDate")
            .InputFormat("yyMMdd")
            .NullFormatter(NullFormatter.ForValue("000000")); // if the read value is "000000" or "      " then should pass as null
        mapper.CustomMapping(new RecordNumberColumn("RecordNumber")
        {
            IncludeSchema = true,
            IncludeSkippedRecords = true
        }, 0).WithReader(r => r.RecordNumber);
        return mapper;
    }
    public static bool GetMapperPredicate(string x)
    {
        return x.StartsWith("11A");
    }
}
 
     
    