Closed jnm2 closed 4 years ago
A PR would be great, thanks! I wonder if it would be better to add something like Type GetType()
to IDbfValue and the implementations of DbfValue
@chrisrichards Oh, interesting. Would that allow GetFieldType to work even if there are no values, e.g. when Read() has not yet been called or after Read() returns false
?
Yes it would, the values are created in the DbfRecord constructor before any records have been read
Fixed by #49
Nice, thank you for the fast release!
We were hoping to use Dapper's
dataReader.Parse<T>();
extension method, but Dapper calls IDataReader.GetFieldType and the current implementation crashes:https://github.com/yellowfeather/DbfDataReader/blob/a68402cf31039807c834641012279d160a6aad8c/src/DbfDataReader/DbfDataReader.cs#L255-L258
This is the call stack from Dapper:
Would you take a pull request to implement GetFieldType?
It looks the implementation could be something like a switch on
DbfTable.Columns[ordinal].ColumnType
similar to the switch inDbfRecord.CreateDbfValue
.