We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Object of type 'System.Int64' cannot be converted to type 'System.Int32 Show this type of the Error But Values Insert In Table
The text was updated successfully, but these errors were encountered:
I just ran into this myself. This comes from the library trying to update your DTO with the inserted identity. It assumes the identity is a long: https://github.com/tmsmith/Dapper-Extensions/blob/master/DapperExtensions/DapperImplementor.cs#L613
long
So when it tries to update your DTO to set the identity value, it throws that exception: https://github.com/tmsmith/Dapper-Extensions/blob/master/DapperExtensions/DapperImplementor.cs#L710
This means it successfully inserted the item (which is why you saw it in the table), but throws an exception processing the result.
I've seen on StackOverflow that the general advise seems to be to use a different key type in your table, such as a GUID or BIGINT.
To anyone thinking of submitting a PR for this, keep in mind that every SQL Dialect may need to be updated too. For instance, the SqlServerDialect casts the scope identity to a bigint: https://github.com/tmsmith/Dapper-Extensions/blob/master/DapperExtensions/Sql/SqlServerDialect.cs#L23
Sorry, something went wrong.
No branches or pull requests
Object of type 'System.Int64' cannot be converted to type 'System.Int32
Show this type of the Error But Values Insert In Table
The text was updated successfully, but these errors were encountered: