Class AssetUrlResolver

Gets the asset url.

Inheritance
System.Object
AssetUrlResolver
Inherited Members
System.Object.ToString()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
Namespace: EPiServer.Commerce.Catalog
Assembly: EPiServer.Business.Commerce.dll
Version: 10.8.0
Syntax
public class AssetUrlResolver

Constructors

AssetUrlResolver(UrlResolver, AssetUrlConventions)

Initializes a new instance of the AssetUrlResolver class.

Declaration
[Obsolete("Use the overload with IContentLoader instead. Will remain at least until April 2016.")]
public AssetUrlResolver(UrlResolver urlResolver, AssetUrlConventions assetUrlConvention)
Parameters
Type Name Description
EPiServer.Web.Routing.UrlResolver urlResolver

The URL resolver.

AssetUrlConventions assetUrlConvention

The asset URL convention.

AssetUrlResolver(UrlResolver, AssetUrlConventions, IContentLoader)

Initializes a new instance of the AssetUrlResolver class.

Declaration
public AssetUrlResolver(UrlResolver urlResolver, AssetUrlConventions assetUrlConvention, IContentLoader contentLoader)
Parameters
Type Name Description
EPiServer.Web.Routing.UrlResolver urlResolver

The URL resolver.

AssetUrlConventions assetUrlConvention

The asset URL convention.

EPiServer.IContentLoader contentLoader

The content loader.

Methods

GetAssetUrl(IAssetContainer)

Gets the asset URL.

Declaration
public string GetAssetUrl(IAssetContainer assetContainer)
Parameters
Type Name Description
IAssetContainer assetContainer

The asset container.

Returns
Type Description
System.String

The asset url.

GetAssetUrl(IAssetContainer, Func<CommerceMedia, String>)

Gets the asset URL.

Declaration
public virtual string GetAssetUrl(IAssetContainer assetContainer, Func<CommerceMedia, string> resolveForSelected)
Parameters
Type Name Description
IAssetContainer assetContainer

The asset container.

System.Func<CommerceMedia, System.String> resolveForSelected

Delegate, which will be called with a selected CommerceMedia. The delegate will return the url of the CommerceMedia.

Returns
Type Description
System.String

The asset url.

GetAssetUrl<TContentMedia>(IAssetContainer)

Gets the asset URL for a specific type.

Declaration
public string GetAssetUrl<TContentMedia>(IAssetContainer assetContainer)
    where TContentMedia : IContentMedia
Parameters
Type Name Description
IAssetContainer assetContainer

The asset container.

Returns
Type Description
System.String

The asset url.

Type Parameters
Name Description
TContentMedia

GetAssetUrl<TContentMedia>(IAssetContainer, Func<CommerceMedia, String>)

Gets the asset URL for a specific type.

Declaration
public virtual string GetAssetUrl<TContentMedia>(IAssetContainer assetContainer, Func<CommerceMedia, string> resolveForSelected)
    where TContentMedia : IContentMedia
Parameters
Type Name Description
IAssetContainer assetContainer

The asset container.

System.Func<CommerceMedia, System.String> resolveForSelected

Delegate, which will be called with a selected CommerceMedia. The delegate will return the url of the CommerceMedia.

Returns
Type Description
System.String

The asset url.

Type Parameters
Name Description
TContentMedia

GetAssetUrl<TContentMedia>(ItemCollection<CommerceMedia>, String)

Gets the asset URL which is considered as default from the mediaList.

Declaration
public virtual string GetAssetUrl<TContentMedia>(ItemCollection<CommerceMedia> mediaList, string defaultGroup)
    where TContentMedia : IContentMedia
Parameters
Type Name Description
ItemCollection<CommerceMedia> mediaList

List of CommerceMedia to get the default one from.

System.String defaultGroup

The default group name.

Returns
Type Description
System.String

The asset URL.

Type Parameters
Name Description
TContentMedia

GetAssetUrl<TContentMedia>(ItemCollection<CommerceMedia>, String, Func<CommerceMedia, String>)

Gets the asset URL which is considered as default from the mediaList, using the custom delegate to resolve asset URL.

Declaration
public virtual string GetAssetUrl<TContentMedia>(ItemCollection<CommerceMedia> mediaList, string defaultGroup, Func<CommerceMedia, string> resolveForSelected)
    where TContentMedia : IContentMedia
Parameters
Type Name Description
ItemCollection<CommerceMedia> mediaList

List of CommerceMedia to get the default one from.

System.String defaultGroup

The default group name.

System.Func<CommerceMedia, System.String> resolveForSelected

Delegate, which will be called with a selected CommerceMedia. The delegate will return the url of the CommerceMedia.

Returns
Type Description
System.String
Type Parameters
Name Description
TContentMedia