From 6f5dcd1880ef0680185375fd77378a50b47563ce Mon Sep 17 00:00:00 2001 From: Travis Parks Date: Sat, 26 Sep 2020 17:45:53 -0400 Subject: [PATCH] Prepare 4.9.0 release --- CHANGELOG.md | 9 +++++++++ FlatFiles/FlatFiles.csproj | 15 ++++++++++----- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1d41b1a..7ed90b4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,12 @@ +## 4.9.0 (2020-09-26) +**Summary** - Make OnParsing, OnParsed, OnFormatting, OnFormatted events available to type mappings. + +When I introduced the `OnParsing`, `OnParsed`, `OnFormatting` and `OnFormatted` delegates, I marked `Preprocessing` as deprecated but then did not mark it deprecated on the `ColumnDefinition` class or in the column property mapping classes. Furthermore, I did not add methods to the property mapping classes to allow you to utilize the new delegates. While working on this, I also realized that whenever the `NullFormatter` or `DefaultValue` classes were being used, I was not executing the `OnParsed` and `OnFormatted` delegates with the output of these classes. So, now, I have marked all references to `Preprocessing` as deprecated, added methods to register the delegates on property mappings and now call `OnParsed` and `OnFormatted` regardless of whether the value being parsed/formatted is considered `null`. + +One of the primary motivations of these changes was to allow inspecting the values found in ignored columns. For example, you might want to ignore a block of text within a file, but also perform some sanity checks to ensure that the ignored value corresponds to your expectations. For example, you might be working on a fixed-width file and you want to ignore pipe (`|`) characters appearing between values; as a sanity check, you additionally want to ensure the extracted string is in fact a pipe. If you saw something else, you could then assume something was wrong with the input text, such as instead of truncating a string to fit within the fixed-width column, the record got shifted over and the values no longer fit within the expected windows. I updated the `Parse` and `Format` methods to call the `OnParsing`, `OnParsed`, `OnFormatting` and `OnFormatted` delegates just like the other column types and updated the property mappings as well. + +An interesting side-effect of these changes is that for `IgnoredColumn`s, spitting out a placeholder value can be achieved either via a `NullFormatter` or using the `OnFormatted` delegate. This is different than the other column types because they are not equipped to handle `null`s. + ## 4.8.0 (2020-09-17) **Summary** - Avoid memory leaks by creating new dynamic assemblies each time. diff --git a/FlatFiles/FlatFiles.csproj b/FlatFiles/FlatFiles.csproj index 70e7cec..467ea6f 100644 --- a/FlatFiles/FlatFiles.csproj +++ b/FlatFiles/FlatFiles.csproj @@ -10,18 +10,19 @@ https://github.com/jehugaleahsa/FlatFiles.git git csv;comma;tab;separated;value;delimited;flat;file;fixed;width;fixed-width;length;fixed-length;parser;parsing;parse - Avoid memory leaks by creating new dynamic assemblies each time. + Allowing configuring OnParsing, OnParsed, OnFormatting, OnFormatted events with type mappings. Raise events when processing ignored columns. true FlatFiles.snk - 4.8.0 + 4.9.0 8.0 - https://raw.githubusercontent.com/jehugaleahsa/FlatFiles/master/icon.png - 4.8.0.0 - 4.8.0.0 + + 4.9.0.0 + 4.9.0.0 UNLICENSE.txt + icon.png @@ -91,6 +92,10 @@ + + True + + True