public void VisitResourceNavigationRefProperty(ResourceInstanceNavProperty navProperty, ResourceBodyTree treeNode, XmlElement parentNode)
 {
     string type = "";
     string hrefKey = null;
     XmlElement inlineElement = null;
     if (treeNode is AssociationResourceInstance)
     {
         AssociationResourceInstance instance = treeNode as AssociationResourceInstance;
         hrefKey = CreateCanonicalUri(instance.ResourceInstanceKey).Replace(Workspace.ServiceUri + @"\", "");
     }
     else
     {
         inlineElement = CreateDataWebMetadataElement("inline");
         if (navProperty is ResourceInstanceNavColProperty)
         {
             XmlElement feedNode = CreateAtomElement("feed");
             this.Visit(navProperty, treeNode, feedNode);
             inlineElement.AppendChild(feedNode);
             type = "feed";
         }
         else
         {
             this.Visit(navProperty, treeNode, inlineElement);
             type = "entry";
         }
     }
     XmlElement linkElement = CreateAtomLinkElement(navProperty, parentNode, hrefKey);
     XmlAttribute typeAttribute = CreateAtomAttribute("type");
     typeAttribute.Value = "application/atom+xml;type=" + type;
     linkElement.Attributes.Append(typeAttribute);
     if (inlineElement != null)
         linkElement.AppendChild(inlineElement);
     parentNode.AppendChild(linkElement);
 }
 public void VisitResourceNavigationProperty(ResourceInstanceNavProperty navProperty, XmlElement parentNode)
 {
     if (navProperty is ResourceInstanceNavColProperty)
         VisitResourceNavigationCollectionProperty(navProperty as ResourceInstanceNavColProperty, parentNode);
     else
         VisitResourceNavigationRefProperty(navProperty as ResourceInstanceNavRefProperty, parentNode);
 }
        private XmlElement CreateAtomLinkElement(ResourceInstanceNavProperty navProperty, XmlElement parentNode, string hrefValue)
        {
            XmlElement linkNode = CreateAtomElement("link");

            XmlAttribute relAttribute = CreateAtomAttribute("rel");
            relAttribute.Value = DataWebRelatedXmlNamespace + navProperty.Name;
            linkNode.Attributes.Append(relAttribute);
            /*
            XmlAttribute titleAttribute = CreateAtomAttribute("title");
            titleAttribute.Value = navProperty.Name;
            linkNode.Attributes.Append(titleAttribute);
            */
            if (hrefValue != null)
            {
                XmlAttribute hrefAttribute = CreateAtomAttribute("href");
                hrefAttribute.Value = hrefValue;
                linkNode.Attributes.Append(hrefAttribute);
            }
            return linkNode;
        }