All parts of the key must be non-nullable

Discussion of open issues, suggestions and bugs regarding Entity Framework support in ADO.NET Data providers
Post Reply
kstough93
Posts: 4
Joined: Sat 16 Jul 2016 02:22

All parts of the key must be non-nullable

Post by kstough93 » Sat 16 Jul 2016 02:29

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.

kstough93
Posts: 4
Joined: Sat 16 Jul 2016 02:22

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

Post by kstough93 » Sat 16 Jul 2016 14:29

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';

Shalex
Site Admin
Posts: 8245
Joined: Thu 14 Aug 2008 12:44

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

Post by Shalex » Tue 19 Jul 2016 11:01

Thank you for letting us know.

Post Reply