Beispiel #1
0
        private void CheckType(EntityType ospaceEntityType)
        {
            _members = new HashSet <EdmMember>();

            foreach (var member in ospaceEntityType.Members)
            {
                var clrProperty = ospaceEntityType.ClrType.GetTopProperty(member.Name);
                if (clrProperty != null
                    &&
                    EntityProxyFactory.CanProxyGetter(clrProperty)
                    &&
                    LazyLoadBehavior.IsLazyLoadCandidate(ospaceEntityType, member))
                {
                    _members.Add(member);
                }
            }
        }
Beispiel #2
0
        internal static Func <TProxy, TItem, bool> GetInterceptorDelegate <TProxy, TItem>(
            EdmMember member,
            Func <object, object> getEntityWrapperDelegate)
            where TProxy : class
            where TItem : class
        {
            Func <TProxy, TItem, bool> func = (Func <TProxy, TItem, bool>)((proxy, item) => true);

            if (member.BuiltInTypeKind == BuiltInTypeKind.NavigationProperty)
            {
                NavigationProperty navProperty = (NavigationProperty)member;
                func = navProperty.ToEndMember.RelationshipMultiplicity != RelationshipMultiplicity.Many ? (Func <TProxy, TItem, bool>)((proxy, item) => LazyLoadBehavior.LoadProperty <TItem>(item, navProperty.RelationshipType.Identity, navProperty.ToEndMember.Identity, true, getEntityWrapperDelegate((object)proxy))) : (Func <TProxy, TItem, bool>)((proxy, item) => LazyLoadBehavior.LoadProperty <TItem>(item, navProperty.RelationshipType.Identity, navProperty.ToEndMember.Identity, false, getEntityWrapperDelegate((object)proxy)));
            }
            return(func);
        }