Class AbstractStockHelper<THelper>
Abstract class for the stock helpers
public abstract class AbstractStockHelper<THelper> where THelper : AbstractStockHelper<THelper>, new()
Type Parameters
THelper
- Inheritance
-
objectAbstractStockHelper<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
Methods
Add(string, object, bool)
Add item.
public static void Add(string key, object value, bool caseSensitive = false)
Parameters
key
stringKey to add
value
objectValue to add
caseSensitive
boolIf 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
stringStorage key
key
stringKey to add
value
objectValue to add
caseSensitive
boolIf 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
stringObject key
caseSensitive
boolIf 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
stringStorage key
key
stringObject key
caseSensitive
boolIf 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
stringStorage key
caseSensitive
boolIf 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
stringObject key
caseSensitive
boolIf 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
ActionAction to execute
key
stringStorage key
caseSensitive
boolIf 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
stringObject key
caseSensitive
boolIf 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
stringStorage key
key
stringObject key
caseSensitive
boolIf 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
stringStorage key
caseSensitive
boolIf true, the key is case sensitive, otherwise key is converted to lowercase before use
ensure
boolIf 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
stringObject key
caseSensitive
boolIf 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
stringStorage key
key
stringObject key
caseSensitive
boolIf true, the key is case sensitive, otherwise key is converted to lowercase before use