Hi,
I am trying to load a file using FileHelpers (like it already except for this one issue :P ) I have to save CSV file data into the database, and so am using a SqlDecimal datatype to store the decimal values of the CSV files.
[FileHelpers.FieldOptional()]
[FileHelpers.FieldConverter(typeof(SqlDecimalConverter))]
public SqlDecimal Rate;
All this works fine, until I have a blank value for the FixRate1. This is flagged up with an error.
"Warn Exception:Null Value found for the field 'Rate' in the class 'SWTrade'. You must specify a FieldNullValueAttribute because this is a ValueType and can´t be null."
I tried putting [FileHelpers.FieldNullValue(SqlDecimal.Null)] but it obviously throws an error.
An attribute argument must be a constant expression, typeof expression or array creation expression of an attribute parameter type
Even though I override the FieldToString method in the SqlDecimalConverter class, the function is not called, when reading the data.
Well, this being the case, is there a way I can assign any null value or even some other hardcoded value to the Rate data, which I can then replace with a null direclty in my own logic ?
Please do let me know if you would need more details. Thanks in advance.