Interface INavigationPropertyInspector allows to override the default mechanism of inspecting the entity navigation properties (entity references and entity collections)

All occurrences of PropertyInfo.GetValue have been encapsulated in the DefaultNavigationPropertyInspector class. PropertyInfo.GetValue should no longer be directly used throughout the library, otherwise it may provoke unwanted effects if the property getters are non-trivial (e.g. implement lazy loading). Applications are also encouraged to switch to the new syntax:

foreach (var navProp in entity.GetNavigationProperties())
{
    // 1-1 and M-1 properties
    foreach (var refProp in navProp.AsReferenceProperty())
        DoSomething(refProp.EntityReference);

    // 1-M and M-M properties
    foreach (var colProp in navProp.AsCollectionProperty())
        DoSomething(colProp.EntityCollection);
}

Advantages over the standard "loop-all-properties-GetValue-and-cast" technique
1. PropertyInfo.GetValue is unfriendly to lazy loading, whilst the custom implementation of the INavigationPropertyInspector interface has chance to terminate visitation of the uninitialized navigation properties
2. Easier to debug the "for-loops". No need to tap F10 like mad to skip the non-navigation properties when you are only interested in visiting nav props
3. More narrow scope for 'refProp' and 'colProp' variables == safer code
4. Elegant casting syntax, e.g. entity.GetNavigationProperties().OfCollectionType<IList>() returns collection navigation properties of type IList
Json serializer must skip navigation properties with null values