Table of Contents

Class FieldOptionService

Namespace
Dynamicweb.Ecommerce.Products
Assembly
Dynamicweb.Ecommerce.dll
public class FieldOptionService : ICacheStorage<string, FieldOption>, ICacheStorage<string>, ICacheStorage
Inheritance
FieldOptionService
Implements
Inherited Members

Properties

Info

Information about the object cache

public CacheInformation Info { get; }

Property Value

CacheInformation

Methods

ClearCache()

Resets all keys to the default value for objects stored in the object cache

public void ClearCache()

ClearCache(IEnumerable<string>)

Resets the specified keys to the default value for objects stored in the object cache

public void ClearCache(IEnumerable<string> keys)

Parameters

keys IEnumerable<string>

Keys to reset

ClearCache(string)

Resets the specified key to the default value for objects stored in the object cache

public void ClearCache(string key)

Parameters

key string

Key to reset

ClearCacheByFieldId(string)

public void ClearCacheByFieldId(string fieldId)

Parameters

fieldId string

Copy(FieldOption)

Retrieves shallow copy of the current object.

public virtual FieldOption Copy(FieldOption option)

Parameters

option FieldOption

Returns

FieldOption

Shallow copy of the current object.

Exceptions

ArgumentNullException

Throw when option is null.

Delete(string)

Deletes specified option.

public virtual void Delete(string optionId)

Parameters

optionId string

An ID of the option to delete.

Exceptions

ArgumentException

Thrown when optionId is null or empty.

DeleteAll(string)

Deletes all options that belongs to specified field.

public virtual void DeleteAll(string fieldId)

Parameters

fieldId string

An ID of either a product field or a product group field.

Exceptions

ArgumentException

Thrown when fieldId is null or empty.

DeleteByIds(IEnumerable<string>, string)

Deletes all options and or translations for specified option IDs and language ID.

public virtual void DeleteByIds(IEnumerable<string> ids, string languageId)

Parameters

ids IEnumerable<string>

A collection of option IDs to delete.

languageId string

The language ID for which the options should be deleted, optional.

Exceptions

ArgumentNullException

Thrown when ids is null.

DeleteExcessOptionTranslations()

Deletes non existing options translations.

public virtual void DeleteExcessOptionTranslations()

DeleteFieldOptionTranslations(string)

Deletes product field options by given field ID.

public virtual void DeleteFieldOptionTranslations(string fieldId)

Parameters

fieldId string

The ID of the field.

Exceptions

ArgumentException

Thrown when fieldId is null or empty.

DeleteFieldOptionTranslations(string, string?)

Deletes product field option translations by given field ID and language ID (optional).

public virtual void DeleteFieldOptionTranslations(string fieldId, string? languageId)

Parameters

fieldId string

The ID of the field.

languageId string

The ID of the language. If null, all translations for the field will be deleted.

Exceptions

ArgumentException

Thrown when fieldId is null or empty.

DeleteTranslation(int)

Deletes a translation by its ID.

public virtual void DeleteTranslation(int id)

Parameters

id int

The translation ID.

Exceptions

ArgumentOutOfRangeException

Thrown when id is negative or zero.

GetOptionById(string)

Retrieves an option from by its ID.

public virtual FieldOption? GetOptionById(string optionId)

Parameters

optionId string

An ID of the option.

Returns

FieldOption

Option instance or null (Nothing in Visual Basic) if the specified option can not be found.

Exceptions

ArgumentException

Thrown when optionId is null or empty.

GetOptionsByFieldId(string)

Retrieves a collection of options that matches specified field ID.

public virtual FieldOptionCollection GetOptionsByFieldId(string fieldId)

Parameters

fieldId string

An ID of the field.

Returns

FieldOptionCollection

A collection of options that matches specified field ID.

Remarks

The resulting collection is sorted ascending by the sort number.

Exceptions

ArgumentException

Thrown when fieldId is null or empty.

GetOptionsByFieldIdAndValues(string, HashSet<string>)

Retrieves a collection of options that matches specified field ID.

public virtual FieldOptionCollection GetOptionsByFieldIdAndValues(string fieldId, HashSet<string> optionValues)

Parameters

fieldId string

An ID of the field.

optionValues HashSet<string>

Returns

FieldOptionCollection

A collection of options that matches specified field ID.

Remarks

The resulting collection is sorted ascending by the sort number.

Exceptions

ArgumentException

Thrown when fieldId is null or empty.

ArgumentNullException

Thrown when optionValues is null.

MaximumSort(string)

Retrieves the maximum sort number for options that matches specified field ID.

public virtual int MaximumSort(string fieldId)

Parameters

fieldId string

An ID of the field.

Returns

int

The maximum sort number for options that matches specified field ID.

Exceptions

ArgumentException

Thrown when fieldId is null or empty.

MinimumSort(string)

Retrieves the minimum sort number for options that matches specified field ID.

public virtual int MinimumSort(string fieldId)

Parameters

fieldId string

An ID of the field.

Returns

int

The minimum sort number for options that matches specified field ID.

Exceptions

ArgumentException

Thrown when fieldId is null or empty.

Save(FieldOption)

Saves an option.

public virtual void Save(FieldOption option)

Parameters

option FieldOption

The FieldOption to save.

Exceptions

ArgumentNullException

Thrown when option is null.

InvalidOperationException

Thrown when the FieldId of option is null or empty.

SaveOptions(IEnumerable<FieldOption>)

Saves a collection of FieldOptions.

public virtual void SaveOptions(IEnumerable<FieldOption> options)

Parameters

options IEnumerable<FieldOption>

The collection of FieldOptions to save.

Exceptions

ArgumentNullException

Thrown when options is null.

SaveTranslation(FieldOptionTranslation)

Saves a field option translation.

public virtual void SaveTranslation(FieldOptionTranslation fieldOptionTranslation)

Parameters

fieldOptionTranslation FieldOptionTranslation

The FieldOptionTranslation to save.

Exceptions

ArgumentNullException

Thrown when fieldOptionTranslation is null.

InvalidOperationException

Thrown when OptionId of fieldOptionTranslation is null or empty.

SetCacheType<TObjectCache>()

Changes the storage container

public void SetCacheType<TObjectCache>() where TObjectCache : ServiceCache<string, FieldOption>

Type Parameters

TObjectCache
To top