Hi,
since we started using 4.1.101 we have a lot InvalidCastException's.
Older versions never got a problem when we compared a Long with an ULong id, but now it throws an exception. The MySQL database has the field defined as int(10) UN PK AI.
Any idea what could be the problem?
Best regards,
Alex
InvalidCastException since update
Re: InvalidCastException since update
If we understood you correctly, you have the int(10) unsigned, PK, autoincrement column in the database and in the model it is mapped to ULong (Int64).
Could you please specify the following:
- the query with which you are getting the data;
- the stack trace of the exception.
Could you please specify the following:
- the query with which you are getting the data;
- the stack trace of the exception.
Re: InvalidCastException since update
For general it seems the type-check in linq connect is much more precise.
Before the new version it was possible to use a String as an id for a where query if the id type in database was an integer
This was really usefull, allowes a sloppier programming style but left you the decision how you like to program
The stronger type checking will become an annoyance if you have old code and suddently there are errors everywhere becauese of a stronger type checking in queries
So this is not a problem limited to one type conversion but a general problem!
Thanks for help!
Before the new version it was possible to use a String as an id for a where query if the id type in database was an integer
Code: Select all
db.Table.Where(function(x) x.id = idAsString)

The stronger type checking will become an annoyance if you have old code and suddently there are errors everywhere becauese of a stronger type checking in queries

So this is not a problem limited to one type conversion but a general problem!
Thanks for help!
Re: InvalidCastException since update
We have fixed some issues related to the casting of the numeric types (e.g., issues with the "Specified cast is not valid" exception). The fix will be available in the next build of LinqConnect, which we plan to release this week.
As for the implicitly converting strings to integer type in the queries as you posted above, thank you for the comment on this, we will investigate the possibility to implementing this functionality, but we can't tell any timeframe at the moment.
As for the implicitly converting strings to integer type in the queries as you posted above, thank you for the comment on this, we will investigate the possibility to implementing this functionality, but we can't tell any timeframe at the moment.
Re: InvalidCastException since update
New build of LinqConnect 4.1.137 is available for download now!
It can be downloaded from http://www.devart.com/linqconnect/download.html (trial version) or from Registered Users' Area (for users with valid subscription only).
For more information, please refer to http://forums.devart.com/viewtopic.php?f=31&t=25387
It can be downloaded from http://www.devart.com/linqconnect/download.html (trial version) or from Registered Users' Area (for users with valid subscription only).
For more information, please refer to http://forums.devart.com/viewtopic.php?f=31&t=25387