Table of Contents

Class AbstractStockHelper<THelper>

Namespace
CMS.Helpers
Assembly
CMS.Helpers.dll

Abstract class for the stock helpers

public abstract class AbstractStockHelper<THelper> where THelper : AbstractStockHelper<THelper>, new()

Type Parameters

THelper
Inheritance
object
AbstractStockHelper<THelper>
Derived
Extension Methods

Fields

Instance

Helper instance

protected static THelper Instance

Field Value

THelper

Properties

CurrentItems

Current items collection.

protected abstract IThreadContextItems CurrentItems { get; }

Property Value

IThreadContextItems

Methods

Add(string, object, bool)

Add item.

public static void Add(string key, object value, bool caseSensitive = false)

Parameters

key string

Key to add

value object

Value to add

caseSensitive bool

If true, the key is case sensitive, otherwise key is converted to lowercase before use

AddToStorage(string, string, object, bool)

Adds item to specific storage specified by storageKey.

public static void AddToStorage(string storageKey, string key, object value, bool caseSensitive = true)

Parameters

storageKey string

Storage key

key string

Key to add

value object

Value to add

caseSensitive bool

If true, the key is case sensitive, otherwise key is converted to lowercase before use

Contains(string, bool)

Check if stock contain item.

public static bool Contains(string key, bool caseSensitive = false)

Parameters

key string

Object key

caseSensitive bool

If true, the key is case sensitive, otherwise key is converted to lowercase before use

Returns

bool

Contains(string, string, bool)

Check if stock contain item.

public static bool Contains(string storageKey, string key, bool caseSensitive = true)

Parameters

storageKey string

Storage key

key string

Object key

caseSensitive bool

If true, the key is case sensitive, otherwise key is converted to lowercase before use

Returns

bool

DropStorage(string, bool)

Drops the storage

public static void DropStorage(string key, bool caseSensitive = true)

Parameters

key string

Storage key

caseSensitive bool

If true, the key is case sensitive, otherwise key is converted to lowercase before use

EnsureObject<ObjectType>(string, bool)

Ensures the object in request items

[Obsolete("Method was not intended for public use and will be removed in the next version.")]
[ObsoleteSince(28, 3)]
public static ObjectType EnsureObject<ObjectType>(string key, bool caseSensitive = true) where ObjectType : new()

Parameters

key string

Object key

caseSensitive bool

If true, the object key is case sensitive, otherwise key is converted to lowercase before use

Returns

ObjectType

Type Parameters

ObjectType

ExecuteWithEmptyStorage(Action, string, bool)

Executes the given action while ensuring the empty storage under the given key for the time being of the action. Restores original storage after the action.

[Obsolete("Method was not intended for public use and will be removed in the next version.")]
[ObsoleteSince(28, 3)]
public static void ExecuteWithEmptyStorage(Action action, string key, bool caseSensitive = true)

Parameters

action Action

Action to execute

key string

Storage key

caseSensitive bool

If true, the key is case sensitive, otherwise key is converted to lowercase before use

GetItem(string, bool)

Returns object which matches by key.

public static object GetItem(string key, bool caseSensitive = false)

Parameters

key string

Object key

caseSensitive bool

If true, the key is case sensitive, otherwise key is converted to lowercase before use

Returns

object

GetItem(string, string, bool)

Returns object which matches by key.

public static object GetItem(string storageKey, string key, bool caseSensitive = true)

Parameters

storageKey string

Storage key

key string

Object key

caseSensitive bool

If true, the key is case sensitive, otherwise key is converted to lowercase before use

Returns

object

GetStorage(string, bool, bool)

Gets the storage

public static SafeDictionary<string, object> GetStorage(string key, bool caseSensitive = true, bool ensure = true)

Parameters

key string

Storage key

caseSensitive bool

If true, the key is case sensitive, otherwise key is converted to lowercase before use

ensure bool

If true, the storage is ensured if it doesn't exist

Returns

SafeDictionary<string, object>

Remove(string, bool)

Remove item.

public static void Remove(string key, bool caseSensitive = false)

Parameters

key string

Object key

caseSensitive bool

If true, the key is case sensitive, otherwise key is converted to lowercase before use

Remove(string, string, bool)

Remove item.

public static void Remove(string storageKey, string key, bool caseSensitive = true)

Parameters

storageKey string

Storage key

key string

Object key

caseSensitive bool

If true, the key is case sensitive, otherwise key is converted to lowercase before use