public override Uri BuildIdLink(ResourceContext instanceContext, ODataMetadataLevel metadataLevel)
        {
            if (IdLinkBuilder != null)
            {
                return(IdLinkBuilder.Factory(instanceContext));
            }

            return(null);
        }
        public override string BuildIdLink(EntityInstanceContext instanceContext, ODataMetadataLevel metadataLevel)
        {
            if (IdLinkBuilder != null)
            {
                return(IdLinkBuilder.Factory(instanceContext));
            }

            return(null);
        }
        /// <summary>
        /// Constructs the IdLink for a particular <see cref="ResourceContext" /> and <see cref="ODataMetadataLevel" />.
        /// </summary>
        public virtual Uri BuildIdLink(ResourceContext instanceContext, ODataMetadataLevel metadataLevel)
        {
            if (instanceContext == null)
            {
                throw Error.ArgumentNull(nameof(instanceContext));
            }

            if (IdLinkBuilder != null &&
                (metadataLevel == ODataMetadataLevel.Full ||
                 (metadataLevel == ODataMetadataLevel.Minimal && !IdLinkBuilder.FollowsConventions)))
            {
                return(IdLinkBuilder.Factory(instanceContext));
            }

            // Return null to let ODL decide when and how to build the id link.
            return(null);
        }