Class DataStoreKeyTransformerProxy
A proxy class that converts data storage keys by adding a prefix to the key.
Inheritance
Inherited Members
Namespace: Terrasoft.Core.Store
Assembly: Terrasoft.Core.dll
Syntax
public class DataStoreKeyTransformerProxy : IDataStoreProxy, IDataStore, IBaseStore
Remarks
This class provides a simple and effective mechanism for organizing the allocated key space in the storage. This mechanism can be used to separate the data stored in the data storage by different users.
Constructors
DataStoreKeyTransformerProxy(String)
Initializes an instance of the DataStoreKeyTransformerProxy proxy class with the specified prefix, which is added to the keys of the storage items.
Declaration
public DataStoreKeyTransformerProxy(string keyPrefix)
Parameters
Type | Name | Description |
---|---|---|
System.String | keyPrefix | The prefix that is added to the keys. |
Exceptions
Type | Condition |
---|---|
ArgumentNullOrEmptyException | If an empty string or |
Properties
DataStore
The data storage that the proxy class operates with.
Declaration
public IDataStore DataStore { get; set; }
Property Value
Type | Description |
---|---|
IDataStore |
Item[String]
Gets or sets the storage item for the specified key.
Declaration
public object this[string key] { get; set; }
Parameters
Type | Name | Description |
---|---|---|
System.String | key | The key of the item. |
Property Value
Type | Description |
---|---|
System.Object | The value of the element for the |
Remarks
The key
passed key that preconfigured as follows: a prefix defined by the KeyPrefix property is added to it. After this, a data storage item with the resulting transformed key is returned or installed.
KeyPrefix
The prefix of the storage item key.
Declaration
public string KeyPrefix { get; }
Property Value
Type | Description |
---|---|
System.String |
Keys
A list of untransformed storage keys.
Declaration
public IEnumerable<string> Keys { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<System.String> |
Remarks
A method from the entire collection of global storage keys defines the keys that start with the KeyPrefix prefix and returns them in a non-transformed form (without the prefix).
Methods
Initialize(IDictionary<String, String>)
Initializes proxy class properties with the passed parameters.
Declaration
public virtual void Initialize(IDictionary<string, string> parameters)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IDictionary<System.String, System.String> | parameters | Parameters for initialization. |
Remove(String)
Deletes the data storage item for the specified key.
Declaration
public void Remove(string key)
Parameters
Type | Name | Description |
---|---|---|
System.String | key | The key of the element you are deleting. |
Remarks
The key
passed key that preconfigured as follows: a prefix defined by the KeyPrefix property is added to it. After that, the element with the transformed key is deleted from the data storage.
TransformKey(String)
Declaration
protected virtual string TransformKey(string key)
Parameters
Type | Name | Description |
---|---|---|
System.String | key |
Returns
Type | Description |
---|---|
System.String |