Class VariantOptionService
- Namespace
- Dynamicweb.Ecommerce
- Assembly
- Dynamicweb.Ecommerce.dll
Provides methods for querying and persisting the VariantOption values of the variant groups.
public class VariantOptionService : ICacheStorage<string, VariantOption>, ICacheStorage<string>, ICacheStorage
- Inheritance
-
VariantOptionService
- Implements
- Inherited Members
Properties
Info
Gets information about the state of the variant option cache.
public virtual CacheInformation Info { get; }
Property Value
Methods
ClearCache()
Clears the variant option cache and raises the variant option cleared notification.
public virtual void ClearCache()
ClearCache(IEnumerable<string>)
Clears the given variant options from the cache and raises the variant option cleared notification.
public virtual void ClearCache(IEnumerable<string> keys)
Parameters
keysIEnumerable<string>The IDs of the variant options to evict.
ClearCache(string)
Clears the given variant option from the cache and raises the variant option cleared notification.
public virtual void ClearCache(string key)
Parameters
keystringThe ID of the variant option to evict.
Delete(string)
Deletes the variant option with the given ID, along with the property values it carries. Does nothing
when id is empty.
public virtual void Delete(string id)
Parameters
idstringThe ID of the variant option.
Remarks
The variant products and combinations built on the option are left behind. Use DeleteVariantOption(string) to remove those as well.
DeleteByVariantGroup(string)
Deletes every variant option belonging to the given variant group and clears the option cache.
public virtual void DeleteByVariantGroup(string variantGroupId)
Parameters
variantGroupIdstringThe ID of the variant group.
DeleteVariantOption(string)
Deletes the variant option with the given ID, along with its property values and every variant product
and combination built on it. Does nothing when id is empty.
public virtual void DeleteVariantOption(string id)
Parameters
idstringThe ID of the variant option.
GetByGroup(string)
Gets every variant option in the given variant group, across all languages.
public virtual IList<VariantOption> GetByGroup(string variantGroupId)
Parameters
variantGroupIdstringThe ID of the variant group.
Returns
- IList<VariantOption>
The options in the group, ordered by sort order; empty when the group has none or no group ID was given.
GetByVariantId(string)
Get a collection of VariantOption matching the specified variantId.
public virtual IList<VariantOption> GetByVariantId(string variantId)
Parameters
variantIdstringThe variant option ID, combined with ".", e.g. "VO1.VO2".
Returns
- IList<VariantOption>
The options making up the variant, in the order they appear in
variantId. Unknown option IDs are skipped.
GetVariantOption(string)
Gets the variant option with the given ID.
public virtual VariantOption? GetVariantOption(string id)
Parameters
idstringThe ID of the variant option.
Returns
- VariantOption
The variant option, or null when no option has that ID.
Save(VariantOption)
Persists the given variantOption to the underlying data store and puts it in the
cache. Does nothing when variantOption is null.
public virtual void Save(VariantOption variantOption)
Parameters
variantOptionVariantOptionThe variant option to save.
SetCacheType<TObjectCache>()
Switches the variant option cache to the given cache implementation.
public virtual void SetCacheType<TObjectCache>() where TObjectCache : ServiceCache<string, VariantOption>
Type Parameters
TObjectCacheThe cache implementation to use.