/// <summary> /// Marks the member property as being declared in metadata /// </summary> /// <param name="navigationProperty">The navigation property.</param> public static void MakeMetadataDeclared(this NavigationProperty navigationProperty) { if (!navigationProperty.IsMetadataDeclaredProperty()) { navigationProperty.Annotations.Add(new MetadataDeclaredPropertyAnnotation()); } }
/// <summary> /// Reviews a specific association set to see if it needs to be declared in the metadata /// </summary> /// <param name="associationSet">Association set to review</param> /// <returns>True or false on if this is declared or not</returns> public static bool IsMetadataDeclaredAssociationSet(this AssociationSet associationSet) { ExceptionUtilities.CheckArgumentNotNull(associationSet, "associationSet"); // if the navigation is declared in either direction, the set must be declared NavigationProperty property0 = associationSet.AssociationType.Ends[0].FromNavigationProperty(); NavigationProperty property1 = associationSet.AssociationType.Ends[1].FromNavigationProperty(); if (property0 != null && property0.IsMetadataDeclaredProperty()) { return(true); } if (property1 != null && property1.IsMetadataDeclaredProperty()) { return(true); } return(false); }