I am attempting to use the MySql Entity Framework provider for a small project. I’ve always encountered “quirks” when working with the MySql Connector (the one developed by MySQL, not DevArt).
The latest thing I found was that my entities generated from the database are getting long instead of int for their Id fields even though the type in the database is specified as a SIGNED INTEGER, AUTO INCREMENT, PRIMARY KEY.
The only thing I can think of is that LAST_INSERT_ID() always returns long. Since my entities rely on the database to create the identity value, perhaps MySQL Connector makes the Ids long to accommodate the id retrieval after insert?
The easiest workaround for all the issues I’ve encountered would be to just use SQL Server. However, the target for this app is shared hosting. Even if you pay for a SQL Server add-on, most shared hosts limit the SQL Server instances to 200MB and only allow 1 or 2 databases. That is just too small in my opinion. The same hosts offer several 1GB MySQL databases for free. If you outgrow that, you probably should have a dedicated box anyway.
MySQL will allways return a 64 bit int (or a BIGINT) instead of a 32 bit int. That’s why you’re getting a long instead of an int.
See this bugreport: http://bugs.mysql.com/bug.php?id=64084, and the MySQL manual on LAST_INSERT_ID(): http://dev.mysql.com/doc/refman/5.5/en/information-functions.html#function_last-insert-id.