You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
40 not all required fields in result model using read validation are be considered (#44)
* Add all missing field in error file.
* Handling Enums
* even if the result is filled with lots of data but the result model only have a few properties it still should map it.
* Always skip validation, only validate when beeing asked to.
---------
Co-authored-by: Tino Klijn <tino@dotnet2web.nl>
Copy file name to clipboardExpand all lines: CsvCore/Documentation/CsvCoreReader.md
+19-20Lines changed: 19 additions & 20 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -84,11 +84,27 @@ When you have the model all setup use the `CsvCoreReader` to read the csv file,
84
84
85
85
### Validations
86
86
87
-
Ofcourse you will receive csv files that are not valid, so we added some validations to the reader.
87
+
Ofcourse you will receive csv files that are not valid.
88
88
89
-
We will validate the data before adding them to the result models, any record that cant be parsed correctly will be added to errors.csv file.
89
+
By default `CsvCoreReader` won't validate the data, it just reads the csv file and maps the data to your model.
90
+
If you want `CsvCoreReader` to validate the data, you can use the `Validate` method.
90
91
91
-
The file will be stored at the location your application will be run. The filename will be the same as the original file, but we just add `_errors` to it.
This will validate the data before it adds the line into the result model. If the data is not valid, it will be added to the errors.csv file.
101
+
The reader will return a list with valid objects and the errors will be written to the errors.csv file as described in the next section.
102
+
103
+
**A little note:**
104
+
-_If you have a non-nullable dateonly / datetime property in your model, and the csv file contains a null value, the reader will set these properties to their MinValues._
105
+
106
+
When using the `Validate` method, the reader will create a file called `<originalfilename>_errors.csv` in the same location as your application is run.
107
+
The filename will be the same as the original file, but we just add `_errors.csv` to it.
92
108
93
109
If you need those error files to be written somewhere else simply use the `.SetErrorPath("AnyPath")` method on the reader
94
110
@@ -126,20 +142,3 @@ The `IsValid` method will return a `List<ValidationModel>` containing:
126
142
- The reason why the data could not be parsed stored in the error message property
127
143
128
144
This could be handy in numerous ways.
129
-
130
-
And how about skipping the validation. If you want to skip the validation, you can use the `SkipValidation` method.
This will skip the validation and read the csv file without validating the data.
140
-
The result will be a list of `ResultModel` objects, but the data will not be validated.
141
-
142
-
**A little note about the validation:**
143
-
-_If you have a non-nullable dateonly / datetime property in your model, and the csv file contains a null value, the reader will set these properties to their MinValues._
144
-
145
-
This way you can do whatever you want with the result.
0 commit comments