/// <summary> /// Constructs a ReadLink URL for a particular <see cref="EntityInstanceContext" /> and <see cref="ODataMetadataLevel" />. /// </summary> public virtual Uri BuildReadLink(EntityInstanceContext instanceContext, ODataMetadataLevel metadataLevel, Uri editLink) { if (instanceContext == null) { throw Error.ArgumentNull("instanceContext"); } if (_readLinkBuilder == null) { // read link is the same as edit link. emit only in default metadata mode. if (metadataLevel == ODataMetadataLevel.Default) { return(editLink); } } else if (IsDefaultOrFull(metadataLevel) || (IsMinimal(metadataLevel) && !_readLinkBuilder.FollowsConventions)) { // read link is not the same as edit link. Generate if the client asked for it (full metadata modes) or // if the client cannot infer it (not follow conventions). return(_readLinkBuilder.Factory(instanceContext)); } // client can infer it and didn't ask for it. return(null); }
/// <summary> /// Constructs the IdLink for a particular <see cref="EntityInstanceContext" /> and <see cref="ODataMetadataLevel" />. /// </summary> public virtual Uri BuildIdLink(EntityInstanceContext instanceContext, ODataMetadataLevel metadataLevel) { if (instanceContext == null) { throw Error.ArgumentNull("instanceContext"); } if (_idLinkBuilder == null) { if (metadataLevel == ODataMetadataLevel.Default) { throw Error.InvalidOperation(SRResources.NoIdLinkFactoryFound, _navigationSourceName); } return(null); } if (IsDefaultOrFull(metadataLevel) || (IsMinimal(metadataLevel) && !_idLinkBuilder.FollowsConventions)) { return(_idLinkBuilder.Factory(instanceContext)); } else { // client can infer it and didn't ask for it. return(null); } }
/// <summary> /// Constructs the IdLink for a particular <see cref="EntityInstanceContext" /> and <see cref="ODataMetadataLevel" />. /// </summary> public virtual Uri BuildIdLink(EntityInstanceContext instanceContext, ODataMetadataLevel metadataLevel) { if (instanceContext == null) { throw Error.ArgumentNull("instanceContext"); } if (_idLinkBuilder != null && (metadataLevel == ODataMetadataLevel.FullMetadata || (metadataLevel == ODataMetadataLevel.MinimalMetadata && !_idLinkBuilder.FollowsConventions))) { return(_idLinkBuilder.Factory(instanceContext)); } // Return null to let ODL decide when and how to build the id link. return(null); }
/// <summary> /// Constructs a ReadLink URL for a particular <see cref="EntityInstanceContext" /> and <see cref="ODataMetadataLevel" />. /// </summary> public virtual Uri BuildReadLink(EntityInstanceContext instanceContext, ODataMetadataLevel metadataLevel, Uri editLink) { if (instanceContext == null) { throw Error.ArgumentNull("instanceContext"); } if (_readLinkBuilder != null && (metadataLevel == ODataMetadataLevel.FullMetadata || (metadataLevel == ODataMetadataLevel.MinimalMetadata && !_readLinkBuilder.FollowsConventions))) { // read link is not the same as edit link. Generate if the client asked for it (full metadata modes) or // if the client cannot infer it (not follow conventions). return(_readLinkBuilder.Factory(instanceContext)); } // Return null to let ODL decide when and how to build the read link. return(null); }