Closed cjmairair closed 5 years ago
Hi @cjmairair, oh, strange that worked for me. Can I have a bit more information what was the class structure and what was the values which you passed to FromLocalList ?
I don't know if/when I will be able to get you an example to reproduce this.
I have a big query. And just changing it a little bit caused this error. So it seems like a kind of touchy thing.
Hi @cjmairair, sure, I understand. I managed to catch same error and fix it. But not sure if you faced same. I updated NuGet package, please try when you have time. Thanks!
I believe this is fixed already. Please feel free to reopen if you get this again.
In your generated code - the VALUES part - when it involves numbers (ints or longs), the type of the column is inferred to be an int (unless any of the numbers are bigger than 10^31 I guess).
This is not good when the value should actually be a long (and not an int), because EF can throw this exception:
"The specified cast from a materialized 'System.Int32' type to the 'System.Int64' type is not valid."
Because EF is expecting certain result columns to be bigints, but instead it gets int columns back from the database.
So, you might want to write literal longs as "cast(12345 as bigint)" instead of just "12345". (This fixed the problem for me.)