/// <summary> /// Gets the URL. /// </summary> /// <param name="entity">The entity.</param> /// <returns></returns> /// <remarks> /// This takes into account the current host name in the request. If the current host name matches a host name /// defined in the domain list for the entity being looked up, then the hostname of the current request will /// be used, otherwise the primary (first ordinal) domain will be used for the url. /// </remarks> public UrlResolutionResult GetUrlForEntity(TypedEntity entity) { Mandate.ParameterNotNull(entity, "entity"); using (var uow = ApplicationContext.Hive.OpenReader <IContentStore>()) { if (entity.IsContent(uow)) { return(GetContentUrl(entity)); } if (entity.IsMedia(uow)) { return(GetMediaUrl(entity)); } } throw new NotSupportedException("Unknown entity type"); }
/// <summary> /// Gets the URL. /// </summary> /// <param name="entity">The entity.</param> /// <returns></returns> /// <remarks> /// This takes into account the current host name in the request. If the current host name matches a host name /// defined in the domain list for the entity being looked up, then the hostname of the current request will /// be used, otherwise the primary (first ordinal) domain will be used for the url. /// </remarks> public UrlResolutionResult GetUrlForEntity(TypedEntity entity) { Mandate.ParameterNotNull(entity, "entity"); using (var uow = ApplicationContext.Hive.OpenReader<IContentStore>()) { if (entity.IsContent(uow)) return GetContentUrl(entity); if (entity.IsMedia(uow)) return GetMediaUrl(entity); } throw new NotSupportedException("Unknown entity type"); }