As I was investigating the difference between Include
and Join
I found that :
If the DB does not include a Foreign Keys -it has no navigation props so it's better to use Join
If It does have a navigation props - then use Include
. ( it also save a db hit.)
But one answer here caught my attention:
Include is implemented as a join. Depending on the nullability of the included link it is an inner or left join.
Question :
How does the nullity affects the left / inner join ?
In Sql server I can have a Cities
table and Persons
table and a person can have a NULL
CityID
.
Why does entity Framework decides for me what kind of join it is ?
edit : visualization :
Now lets change CityId to not null :
And here is the change :