Page 1 of 1

All parts of the key must be non-nullable

Posted: Sat 16 Jul 2016 02:29
by kstough93
So this is a new error that just start coming up for me and I'm not sure why. When I try to add a table through EF6, I get the following errors on any fields that are non-nullable. On tables that I have been able to add, if I open the edmx file in XML, I can see that the [Key] section for each table in the StorageSection contains every field in the table. So this is clearly a bug somewhere, but I'm not sure where.

I've done the following:
- Double-checked my data model in MySql (using version 5.7.7)
- Uninstalled and reinstalled Visual Studio 2015
- Uninstalled and reinstalled Entity Framework (version 6.1.3)
- Using the Devart dotConnect MySql Pro Trial (version 8.6.677.0)
- Double-checked all web.config options to make sure they are correct.

Sample Error:
Error 13101: Key part 'LockOutEndDateUtc' for type 'aspnetusers' is not valid. All parts of the key must be non-nullable. HRSMonitor C:\Users\Kevin\Documents\Visual Studio 2015\Projects\HRSMonitor\HRSMonitor\Models\dbHRS.edmx

Any ideas would be greatly appreciated.

Re: All parts of the key must be non-nullable

Posted: Sat 16 Jul 2016 14:29
by kstough93
Found my problem, in MySql, the following statements need to be run and then EF6 cooperates:

set global optimizer_switch='derived_merge=off'; set optimizer_switch='derived_merge=off';

Re: All parts of the key must be non-nullable

Posted: Tue 19 Jul 2016 11:01
by Shalex
Thank you for letting us know.