Skip to content

Commit

Permalink
Remove MustNotifyRead in MultiRecordEngine
Browse files Browse the repository at this point in the history
The EventEngineBase.MustNotifyRead property does not work correctly in MultiRecordEngine. This is because the EngineBase.RecordInfo property is set only based on the first record type. The easy fix is to use the local info.NotiyRead in MultiRecordEngine
  • Loading branch information
nlee39 committed Jul 21, 2017
1 parent eb29fd3 commit cdfe2e5
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions FileHelpers/Engines/MultiRecordEngine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ public object[] ReadStream(IRecordReader reader)
OnProgress(new ProgressEventArgs(currentRecord, -1));

BeforeReadEventArgs<object> e = null;
if (MustNotifyRead) // Avoid object creation
if (info.NotifyRead) // Avoid object creation
{
e = new BeforeReadEventArgs<object>(this, record, currentLine, LineNumber);
skip = OnBeforeReadRecord(e);
Expand All @@ -212,7 +212,7 @@ public object[] ReadStream(IRecordReader reader)
if (skip == false) {
var values = new object[info.FieldCount];
if (info.Operations.StringToRecord(record, line, values)) {
if (MustNotifyRead) // Avoid object creation
if (info.NotifyRead) // Avoid object creation
skip = OnAfterReadRecord(currentLine, record, e.RecordLineChanged, LineNumber);

if (skip == false)
Expand Down Expand Up @@ -646,7 +646,7 @@ private void ReadNextRecord()
var values = new object[info.FieldCount];
mLastRecord = info.Operations.StringToRecord(line, values);

if (MustNotifyRead)
if (info.NotifyRead)
{
OnAfterReadRecord(currentLine, mLastRecord, false, LineNumber);
}
Expand Down

0 comments on commit cdfe2e5

Please sign in to comment.