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.
All parts of the key must be non-nullable
Re: All parts of the key must be non-nullable
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';
set global optimizer_switch='derived_merge=off'; set optimizer_switch='derived_merge=off';
Re: All parts of the key must be non-nullable
Thank you for letting us know.