Exemplo n.º 1
0
 protected InternalMemberEntry(
     InternalEntityEntry internalEntityEntry,
     MemberEntryMetadata memberMetadata)
 {
     this._internalEntityEntry = internalEntityEntry;
     this._memberMetadata      = memberMetadata;
 }
Exemplo n.º 2
0
        public virtual InternalMemberEntry Member(
            string propertyName,
            Type requestedType = null)
        {
            Type type = requestedType;

            if ((object)type == null)
            {
                type = typeof(object);
            }
            requestedType = type;
            IList <string> properties = InternalEntityEntry.SplitName(propertyName);

            if (properties.Count > 1)
            {
                return((InternalMemberEntry)this.Property((InternalPropertyEntry)null, propertyName, properties, requestedType, false));
            }
            MemberEntryMetadata memberEntryMetadata = (MemberEntryMetadata)this.GetNavigationMetadata(propertyName) ?? (MemberEntryMetadata)this.ValidateAndGetPropertyMetadata(propertyName, this.EntityType, requestedType);

            if (memberEntryMetadata == null)
            {
                throw Error.DbEntityEntry_NotAProperty((object)propertyName, (object)this.EntityType.Name);
            }
            if (memberEntryMetadata.MemberEntryType != MemberEntryType.CollectionNavigationProperty && !requestedType.IsAssignableFrom(memberEntryMetadata.MemberType))
            {
                throw Error.DbEntityEntry_WrongGenericForNavProp((object)propertyName, (object)this.EntityType.Name, (object)requestedType.Name, (object)memberEntryMetadata.MemberType.Name);
            }
            return(memberEntryMetadata.CreateMemberEntry(this, (InternalPropertyEntry)null));
        }
Exemplo n.º 3
0
        // <summary>
        // Initializes a new instance of the <see cref="InternalMemberEntry" /> class.
        // </summary>
        // <param name="internalEntityEntry"> The internal entity entry. </param>
        // <param name="memberMetadata"> The member metadata. </param>
        protected InternalMemberEntry(InternalEntityEntry internalEntityEntry, MemberEntryMetadata memberMetadata)
        {
            DebugCheck.NotNull(internalEntityEntry);
            DebugCheck.NotNull(memberMetadata);

            _internalEntityEntry = internalEntityEntry;
            _memberMetadata      = memberMetadata;
        }