src/Shared/EntityFramework/Core/Objects/Internal/LazyLoadBehavior.cs
// <summary>
// Determine if the specified member is compatible with lazy loading.
// </summary>
// <param name="ospaceEntityType"> OSpace EntityType representing a type that may be proxied. </param>
// <param name="member">
// Member of the <paramref name="ospaceEntityType" /> to be examined.
// </param>
// <returns> True if the member is compatible with lazy loading; otherwise false. </returns>
// <remarks>
// To be compatible with lazy loading,
// a member must meet the criteria for being able to be proxied (defined elsewhere),
// and must be a navigation property.
// In addition, for relationships with a multiplicity of Many,
// the property type must be an implementation of ICollection&lt;T&gt;.
// </remarks>
Determine if the specified member is compatible with lazy loading.
Determine if the specified member is compatible with lazy loading .
internal static bool IsLazyLoadCandidate(EntityType ospaceEntityType, EdmMember member)
        {
            Debug.Assert(ospaceEntityType.DataSpace == DataSpace.OSpace, "ospaceEntityType.DataSpace must be OSpace");
            var isCandidate = false;
            if (member.BuiltInTypeKind
                == BuiltInTypeKind.NavigationProperty)
            {
                var navProperty = (NavigationProperty)member;
                var multiplicity = navProperty.ToEndMember.RelationshipMultiplicity;
                var propertyInfo = ospaceEntityType.ClrType.GetTopProperty(member.Name);
                Debug.Assert(propertyInfo != null, "Should have found lazy loading property");
                var propertyValueType = propertyInfo.PropertyType;
                if (multiplicity == RelationshipMultiplicity.Many)
                {
                    isCandidate = propertyValueType.TryGetElementType(typeof(ICollection<>)) != null;
                }
                else if (multiplicity == RelationshipMultiplicity.One
                         || multiplicity == RelationshipMultiplicity.ZeroOrOne)
                {
                    isCandidate = true;
                }
            }
            return isCandidate;
        }
internal static bool IsLazyLoadCandidate ( EntityType ospaceEntityType , EdmMember member ) { Debug . Assert ( ospaceEntityType . DataSpace == DataSpace . OSpace , " " ) ; var isCandidate = false ; if ( member . BuiltInTypeKind == BuiltInTypeKind . NavigationProperty ) { var navProperty = ( NavigationProperty ) member ; var multiplicity = navProperty . ToEndMember . RelationshipMultiplicity ; var propertyInfo = ospaceEntityType . ClrType . GetTopProperty ( member . Name ) ; Debug . Assert ( propertyInfo != null , " " ) ; var propertyValueType = propertyInfo . PropertyType ; if ( multiplicity == RelationshipMultiplicity . Many ) { isCandidate = propertyValueType . TryGetElementType ( typeof ( ICollection < > ) ) != null ; } else if ( multiplicity == RelationshipMultiplicity . One || multiplicity == RelationshipMultiplicity . ZeroOrOne ) { isCandidate = true ; } } return isCandidate ; }
Determine if the specified member is compatible with lazy loading.
Determine if the specified member is compatible with lazy loading .
// This is an EntityReference property.
True if the member is compatible with lazy loading; otherwise false.
True if the member is compatible with lazy loading ; otherwise false .
ospaceEntityType
EntityType
OSpace EntityType representing a type that may be proxied.
OSpace EntityType representing a type that may be proxied .
member
EdmMember
Member of the  to be examined.
Member of the to be examined .
remarks
To be compatible with lazy loading,
a member must meet the criteria for being able to be proxied (defined elsewhere),
and must be a navigation property.
In addition, for relationships with a multiplicity of Many,
the property type must be an implementation of ICollection.
To be compatible with lazy loading a member must meet the criteria for being able to be proxied ( defined elsewhere ) and must be a navigation property . In addition for relationships with a multiplicity of Many the property type must be an implementation of ICollection .