private NavigationEntryMetadata ValidateAndGetNavigationMetadata( string navigationProperty, Type requestedType, bool requireCollection) { if (InternalEntityEntry.SplitName(navigationProperty).Count != 1) { throw Error.DbEntityEntry_DottedPathMustBeProperty((object)navigationProperty); } NavigationEntryMetadata navigationMetadata = this.GetNavigationMetadata(navigationProperty); if (navigationMetadata == null) { throw Error.DbEntityEntry_NotANavigationProperty((object)navigationProperty, (object)this.EntityType.Name); } if (requireCollection) { if (navigationMetadata.MemberEntryType == MemberEntryType.ReferenceNavigationProperty) { throw Error.DbEntityEntry_UsedCollectionForReferenceProp((object)navigationProperty, (object)this.EntityType.Name); } } else if (navigationMetadata.MemberEntryType == MemberEntryType.CollectionNavigationProperty) { throw Error.DbEntityEntry_UsedReferenceForCollectionProp((object)navigationProperty, (object)this.EntityType.Name); } if (!requestedType.IsAssignableFrom(navigationMetadata.ElementType)) { throw Error.DbEntityEntry_WrongGenericForNavProp((object)navigationProperty, (object)this.EntityType.Name, (object)requestedType.Name, (object)navigationMetadata.ElementType.Name); } return(navigationMetadata); }
// <summary> // Initializes a new instance of the <see cref="InternalCollectionEntry" /> class. // </summary> // <param name="internalEntityEntry"> The internal entity entry. </param> // <param name="navigationMetadata"> The navigation metadata. </param> public InternalCollectionEntry( InternalEntityEntry internalEntityEntry, NavigationEntryMetadata navigationMetadata) : base(internalEntityEntry, navigationMetadata) { }
public FakeInternalReferenceEntry(InternalEntityEntry internalEntityEntry, NavigationEntryMetadata navigationMetadata) : base(internalEntityEntry, navigationMetadata) { }
/// <summary> /// Initializes a new instance of the <see cref="InternalReferenceEntry" /> class. /// </summary> /// <param name="internalEntityEntry"> The internal entity entry. </param> /// <param name="navigationMetadata"> The navigation metadata. </param> public InternalReferenceEntry( InternalEntityEntry internalEntityEntry, NavigationEntryMetadata navigationMetadata) : base(internalEntityEntry, navigationMetadata) { }
/// <summary> /// Initializes a new instance of the <see cref="InternalNavigationEntry" /> class. /// </summary> /// <param name="internalEntityEntry"> The internal entity entry. </param> /// <param name="navigationMetadata"> The navigation metadata. </param> protected InternalNavigationEntry( InternalEntityEntry internalEntityEntry, NavigationEntryMetadata navigationMetadata) : base(internalEntityEntry, navigationMetadata) { }
// <summary> // Initializes a new instance of the <see cref="InternalNavigationEntry" /> class. // </summary> // <param name="internalEntityEntry"> The internal entity entry. </param> // <param name="navigationMetadata"> The navigation metadata. </param> protected InternalNavigationEntry( InternalEntityEntry internalEntityEntry, NavigationEntryMetadata navigationMetadata) : base(internalEntityEntry, navigationMetadata) { }