- SQL Server 2008R2
- Entity Framework 4.x (early version)
I recently changed a view within a SQL Server 2088 R2 instance so that it now contains some LEFT OUTER JOINS instead of INNER JOINS which causes some fields to contains NULL now. That leaves with a exception that this fields are not allowed to be null cause they are entity keys.

Please note that all shown are required to be entity keys and that the image just showing a part of the whole view.
So am I doing anything totally wrong? Is there any fix around or do I have to life with it.
Here’s one of the errors
Error 213 Running transformation: Key Part: ‘WorkStepId’ for type
OrderSummary is not valid. All parts of the key must be non nullable.
Entity keys are not allowed to be NULL. Entity Framework has to be able to determine the uniqueness of an entity by a combination of one or more keys. I don’t know your exact data circumstance, but there may be a way to work around this requirement, but it’s not very clean.
A possible workaround is including logic in your view T-SQL to coalesce NULL values to a known “dummy” value. For instance, with your data above, you can set the two NULL values to be -1 on reads. However: