|Title:||Entity framework mapping from double to real not valid in 126.96.36.199|
|Last Modified:||2013-07-15 04:11:42|
|Version Found In:||188.8.131.52|
anonymous added on 2013-07-10 01:46:40:
I was using System.Data.SQLite 184.108.40.206 to create an entity framework model in Visual Studio 2012. The database contains some columns of type REAL. After upgrade to version 220.127.116.11 the entity framework mappings to the columns of type REAL are no longer valid. The error message is: Error 2019: Member Mapping specified is not valid. The type 'Edm.Double[Nullable=False,DefaultValue=]' of member 'TotalReturn' in type 'XxxModel.XxxTable' is not compatible with 'SQLite.real[Nullable=False,DefaultValue=]' of member 'TotalReturn' in type 'XxxModel.Store.XxxTable'. Changing the mapping type from Double to Single causes the error message to go away. However, the SQLite REAL data type is an 8-byte IEEE floating point number, so should be compatible with Double.
mistachkin added on 2013-07-10 02:00:32:
Currently, the REAL database type maps to Double in System.Data.SQLite. The error message you are seeing is coming from the Entity Framework. This appears to be their issue.
anonymous added on 2013-07-10 02:04:50:
Ok, but it works fine if I revert to 18.104.22.168
mistachkin added on 2013-07-10 02:24:00:
Mapping the REAL type to Single would not allow it to store 8-bytes, breaking backward compatibility. Also, this mapping has been present since check-in [/ci/eb6a22a1a904e6fc], made on 2011-07-05 (i.e. just over 2 years ago). That means it has been present since release 22.214.171.124. It was changed in response to bugs [2c630bffa7] and [b0a5990f48].
anonymous added on 2013-07-10 03:46:42:
I think we're misunderstanding each other. I want the data type to be Double, not Single. However, if I try to force it to Double, I get the error message above. When I was using version 1.0.83 I had Visual Studio 2012 generate the entity framework model from my database. It automatically mapped the columns of type REAL to C# properties of type Double. However, when I upgraded to version 1.0.87 the mappings created under version 1.0.83 were no longer valid and the error message I described above appeared. I then re-generated the entity framework model from my database and it automatically mapped the columns of type REAL to C# properties of type Single and the error message disappeared. What I think should happen is that generating the entity framework model from the database should map columns of type REAL to C# properties of type Double, or alternately it should at least allow the user to manually set the type of the C# properties to Double.
mistachkin added on 2013-07-10 09:11:41:
I'm not sure how much influence System.Data.SQLite has on the Entity Framework model generation process. It is possible that a change to System.Data.SQLite somehow impacted how the Entity Framework models are generated; however, I'm not immediately aware of any recent change that would do this. Do you have any additional clues which might help me pinpoint the code in System.Data.SQLite responsible for this issue?
anonymous added on 2013-07-11 23:40:26:
My sincerest apologies. After I encountered the error described above, I downgraded back to 1.0.83 and continued work. Yesterday I re-upgraded to 1.0.87 to see if I could figure out the cause of the problem and it now seems to be working fine. Columns of SQLite type real are now automatically mapped to C# doubles, the error message has disappeared and everything works as expected. I have no idea why it wasn't working when I first upgraded to 1.0.87. Sorry to bother, please close this ticket.