static void engine_AfterReadRecord(EngineBase engine, FileHelpers.Events.AfterReadEventArgs <object> e) { FooBar fooBar = e.Record as FooBar; fooBar.ColumnA_Two = fooBar.ColumnA_One; fooBar.ColumnB_Two = fooBar.ColumnB_One; }
static void engine_AfterReadRecord(EngineBase engine, FileHelpers.Events.AfterReadEventArgs <MyClass> e) { bool isEmailValid = IsEmailValid(e.Record.Email); if (!isEmailValid) { throw new Exception("Email is invalid"); } }
static void engine_AfterReadRecord(EngineBase engine, FileHelpers.Events.AfterReadEventArgs <MyClass> e) { if (String.IsNullOrWhiteSpace(e.Record.Field1)) { throw new Exception("Field1 is invalid"); } if (String.IsNullOrWhiteSpace(e.Record.Field2)) { throw new Exception("Field2 is invalid"); } if (String.IsNullOrWhiteSpace(e.Record.Field3)) { throw new Exception("Field3 is invalid"); } }
private static void engine_AfterReadRecord(EngineBase engine, FileHelpers.Events.AfterReadEventArgs <FixedSampleRecord> e) { }
/// <summary> /// Store original line number to display in messages /// </summary> /// <param name="engine"></param> /// <param name="e"></param> private static void CsvEngine_AfterReadRecord(EngineBase engine, FileHelpers.Events.AfterReadEventArgs <FileFormatModel> e) { e.Record.LineNumber = engine.LineNumber; }