/// <summary> /// Adds an association link to an entry. /// </summary> /// <param name="entry">The entry to get or create the association link for.</param> /// <param name="navigationProperty">The navigation property to get or create the association link for.</param> /// <returns>The association link that we either retrieved or created for the <paramref name="navigationProperty"/>.</returns> internal static ODataAssociationLink GetOrCreateAssociationLinkForNavigationProperty(ODataEntry entry, IEdmNavigationProperty navigationProperty) { DebugUtils.CheckNoExternalCallers(); Debug.Assert(entry != null, "entry != null"); Debug.Assert(navigationProperty != null, "navigationProperty != null"); ODataAssociationLink associationLink = entry.AssociationLinks.FirstOrDefault(al => al.Name == navigationProperty.Name); if (associationLink == null) { associationLink = new ODataAssociationLink { Name = navigationProperty.Name }; entry.AddAssociationLink(associationLink); } return(associationLink); }