World is now on Opti ID! Learn more

Class ImportBase

Base class for different types of asset import implementations.

Inheritance
System.Object
ImportBase
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: Mediachase.Commerce.Assets.Import
Assembly: Mediachase.Commerce.dll
Version: 13.30.0
Syntax
public abstract class ImportBase

Constructors

ImportBase(String)

Initializes a new instance of the ImportBase class.

Declaration
public ImportBase(string assetPath)
Parameters
Type Name Description
System.String assetPath

The local file path where the files to import are present.

Properties

AssetGroups

Gets all available asset groups.

Declaration
public string[] AssetGroups { get; }
Property Value
Type Description
System.String[]
Remarks

The asset groups are determined by subfolders on the first level below the AssetPath. I e if you have the AssetPath set as "C:\Images" and below the folder you have "Small", "Medum", and "Large" then your asset groups will be "Small", "Medium" and "Large".

AssetPath

Gets the local file path where assets to import are stored.

Declaration
public string AssetPath { get; }
Property Value
Type Description
System.String

Methods

AssociateAssetsWithProduct(IEnumerable<AssetWrapper>, CatalogEntryDto)

Associates the assets with aproduct.

Declaration
public void AssociateAssetsWithProduct(IEnumerable<AssetWrapper> assets, CatalogEntryDto productDto)
Parameters
Type Name Description
System.Collections.Generic.IEnumerable<AssetWrapper> assets

The imported assets to associate with product.

CatalogEntryDto productDto

The product that should receive the assets.

DoImport(IEnumerable<AssetMapping>)

Does the import.

Declaration
public abstract void DoImport(IEnumerable<AssetMapping> entries)
Parameters
Type Name Description
System.Collections.Generic.IEnumerable<AssetMapping> entries

The entries to import.

FullAssetPath(String[])

Gets the full path to an asset file.

Declaration
public string FullAssetPath(params string[] segments)
Parameters
Type Name Description
System.String[] segments

The segments for the asset file.

Returns
Type Description
System.String

A correctly joined file path pointing to the asset file.

GetProductDto(String)

Gets the DTO object for a product/variation from ECF.

Declaration
public CatalogEntryDto GetProductDto(string productCode)
Parameters
Type Name Description
System.String productCode

The product code.

Returns
Type Description
CatalogEntryDto

A catalogEntryDto or null if not found.

ValidAssetGroups(String)

Gets all valid asset groups for the asset.

Declaration
public IEnumerable<string> ValidAssetGroups(string assetName)
Parameters
Type Name Description
System.String assetName

Name of the asset.

Returns
Type Description
System.Collections.Generic.IEnumerable<System.String>

The valid asset groups.

Remarks

This handles the case when the mapping file (csv file) contains an entry that maps an asset to a product, but the asset file does not exist in all the different asset group folders. In that case we will only import the asset that actually exists.