|Title:||guid and uniqueidentifier has incorrect ProviderDbType value|
|Last Modified:||2016-08-25 01:53:00|
|Version Found In:||184.108.40.206|
anonymous added on 2016-06-24 20:04:20:
I am attempting to use F# SqlProvider as well as GUID columns (to enable simplified syncing between databases). I found that specifying uniqueidentifier as the column type worked (they appeared as a property of type Guid by the type provider), but an insert would always fail, stating that a Guid could not be cast to an IConvertable. What I found is that the type provider was attempting to map System.Guid to DbType.Currency. After a bit of research, I found that SQLiteConnection.GetSchema("DataTypes") reported both 'guid' and 'uniqueidentifier' as a System.Guid as the CLR data type, but was using the value of 4 for ProviderDbType, which maps to DbType.Currency. DbType.Guid is actually 9. This causes the parameters for insert commands to have a value of type System.Guid, but have a database type of DbType.Currency, which System.Data.SQLite attempts to load as a double by calling IConvertable.ToDouble() (along with DbType.Double and DbType.Single). I believe this can be fixed by modifying Resources\DbTypes.xml such that the last two items have a ProviderDbType value of 9 instead of 4.
mistachkin added on 2016-06-24 20:47:22:
Thanks for the report.
mistachkin added on 2016-06-24 20:56:23:
Preliminary fix checked-in on trunk [81cf9aaddb1f1adc]. Still needs tests.
mistachkin added on 2016-08-25 01:53:00:
Tests added on trunk.