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
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
keysIEnumerable<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
keystringKey to reset
ClearCacheByFieldId(string)
public void ClearCacheByFieldId(string fieldId)
Parameters
fieldIdstring
Copy(FieldOption)
Retrieves shallow copy of the current object.
public virtual FieldOption Copy(FieldOption option)
Parameters
optionFieldOption
Returns
- FieldOption
Shallow copy of the current object.
Exceptions
- ArgumentNullException
Throw when
optionis null.
Delete(string)
Deletes specified option.
public virtual void Delete(string optionId)
Parameters
optionIdstringAn ID of the option to delete.
Exceptions
- ArgumentException
Thrown when
optionIdis null or empty.
DeleteAll(string)
Deletes all options that belongs to specified field.
public virtual void DeleteAll(string fieldId)
Parameters
fieldIdstringAn ID of either a product field or a product group field.
Exceptions
- ArgumentException
Thrown when
fieldIdis 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
idsIEnumerable<string>A collection of option IDs to delete.
languageIdstringThe language ID for which the options should be deleted, optional.
Exceptions
- ArgumentNullException
Thrown when
idsis 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
fieldIdstringThe ID of the field.
Exceptions
- ArgumentException
Thrown when
fieldIdis 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
fieldIdstringThe ID of the field.
languageIdstringThe ID of the language. If null, all translations for the field will be deleted.
Exceptions
- ArgumentException
Thrown when
fieldIdis null or empty.
DeleteTranslation(int)
Deletes a translation by its ID.
public virtual void DeleteTranslation(int id)
Parameters
idintThe translation ID.
Exceptions
- ArgumentOutOfRangeException
Thrown when
idis negative or zero.
GetOptionById(string)
Retrieves an option from by its ID.
public virtual FieldOption? GetOptionById(string optionId)
Parameters
optionIdstringAn 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
optionIdis null or empty.
GetOptionsByFieldId(string)
Retrieves a collection of options that matches specified field ID.
public virtual FieldOptionCollection GetOptionsByFieldId(string fieldId)
Parameters
fieldIdstringAn 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
fieldIdis 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
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
fieldIdis null or empty.- ArgumentNullException
Thrown when
optionValuesis null.
MaximumSort(string)
Retrieves the maximum sort number for options that matches specified field ID.
public virtual int MaximumSort(string fieldId)
Parameters
fieldIdstringAn ID of the field.
Returns
- int
The maximum sort number for options that matches specified field ID.
Exceptions
- ArgumentException
Thrown when
fieldIdis null or empty.
MinimumSort(string)
Retrieves the minimum sort number for options that matches specified field ID.
public virtual int MinimumSort(string fieldId)
Parameters
fieldIdstringAn ID of the field.
Returns
- int
The minimum sort number for options that matches specified field ID.
Exceptions
- ArgumentException
Thrown when
fieldIdis null or empty.
Save(FieldOption)
Saves an option.
public virtual void Save(FieldOption option)
Parameters
optionFieldOptionThe FieldOption to save.
Exceptions
- ArgumentNullException
Thrown when
optionis null.- InvalidOperationException
Thrown when the FieldId of
optionis null or empty.
SaveOptions(IEnumerable<FieldOption>)
Saves a collection of FieldOptions.
public virtual void SaveOptions(IEnumerable<FieldOption> options)
Parameters
optionsIEnumerable<FieldOption>The collection of FieldOptions to save.
Exceptions
- ArgumentNullException
Thrown when
optionsis null.
SaveTranslation(FieldOptionTranslation)
Saves a field option translation.
public virtual void SaveTranslation(FieldOptionTranslation fieldOptionTranslation)
Parameters
fieldOptionTranslationFieldOptionTranslationThe FieldOptionTranslation to save.
Exceptions
- ArgumentNullException
Thrown when
fieldOptionTranslationis null.- InvalidOperationException
Thrown when OptionId of
fieldOptionTranslationis null or empty.
SetCacheType<TObjectCache>()
Changes the storage container
public void SetCacheType<TObjectCache>() where TObjectCache : ServiceCache<string, FieldOption>
Type Parameters
TObjectCache