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
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
@@ -86,40 +86,38 @@ When you have the model all setup use the `CsvCoreReader` to read the csv file,
86
86
87
87
Ofcourse you will receive csv files that are not valid, so we added some validations to the reader.
88
88
89
-
If you don't want to validate the csv file before reading it, just read the file like described above.
90
-
91
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.
92
90
93
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.
94
92
95
-
If you need those error files to be written somewhere else simply use the `.WriteErrorsAt("AnyPath")` method on the reader
93
+
If you need those error files to be written somewhere else simply use the `.SetErrorPath("AnyPath")` method on the reader
96
94
97
95
### Example
98
96
99
97
```csharp
100
98
varresult=csvCoreReader
101
99
.SetErrorPath(@"C:\Temp\Errors") // your errors will be stored in here, ofcourse you would put this in a configuration file ;)
Be aware these options are always tricky so if you encounter any issues with it, please report an issue at GitHub with as much information as possible.
146
-
A unit test example would be awesome!
138
+
139
+
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 litte 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