Demo Video: http://u.115.com/file/f2737fb613
Demonstration highlights
This demonstration focuses on obtaining associated data objects through the foreign key navigation, if the relevant data records are not found, will this cause the exception of not setting the object reference to the object instance?
First, the test results show that, in this case, even if the relevant data records are not found, it will not cause the aforementioned exceptions.
However, if no relevant data record is found when obtaining a single-party associated data object from the collection party, the exception that the object reference is not set to the object instance will be thrown. Therefore, we usually need to determine whether the related single-party object is obtained, that is, whether the object is null.
So what causes such a situation? You can learn more in the video demonstration.