Entity Framework: field of composite key cannot be nullable?

Answer from Raphael lead me to another search. Here is the why it is not possible (answer from Cobsy):

What’s wrong with nullable columns in composite primary keys?

In short:
NULL == NULL -> false

Wierd. The solution for me is to add Id column into Model.

BTW: MySQL allow me not to define Primary Key, then I’m allowed to have such schema – EF complains about not defining the key :-(.

Leave a Comment