Class DictionaryStore<TKey, TValue>
A Key->Value store that will be incrementally saved on the HDD. Thread-safe and process-safe.
public class DictionaryStore<TKey, TValue> : Store<KeyValuePair<TKey, TValue>>, IDisposable where TKey : notnull
  Type Parameters
TKeyThe type of the key.
TValueThe type of the value.
- Inheritance
 - 
      objectStore<KeyValuePair<TKey, TValue>>DictionaryStore<TKey, TValue>
 
- Implements
 
- Derived
 
- Inherited Members
 
- Extension Methods
 
Constructors
DictionaryStore(Stream)
public DictionaryStore(Stream stream)
  Parameters
streamStream
Fields
loadedIdMap
protected readonly Dictionary<TKey, TValue> loadedIdMap
  Field Value
- Dictionary<TKey, TValue>
 
unsavedIdMap
protected readonly Dictionary<TKey, DictionaryStore<TKey, TValue>.UnsavedIdMapEntry> unsavedIdMap
  Field Value
- Dictionary<TKey, DictionaryStore<TKey, TValue>.UnsavedIdMapEntry>
 
Properties
this[TKey]
Gets or sets the item with the specified key.
public TValue this[TKey key] { get; set; }
  Parameters
keyTKeyThe key of the item to get or set.
Property Value
- TValue
 The item to get or set.
Exceptions
Methods
AddLoaded(KeyValuePair<TKey, TValue>)
Adds a value that has already been saved in the store (saved state).
protected override void AddLoaded(KeyValuePair<TKey, TValue> item)
  Parameters
itemKeyValuePair<TKey, TValue>The item.
AddUnsaved(KeyValuePair<TKey, TValue>, int)
Adds a value that has not yet been saved in the store (pending state).
protected override void AddUnsaved(KeyValuePair<TKey, TValue> item, int currentTransaction)
  Parameters
itemKeyValuePair<TKey, TValue>The item.
currentTransactionint
Contains(TKey)
Gets or sets the item with the specified key.
public bool Contains(TKey key)
  Parameters
keyTKeyThe key of the item to get or set.
Returns
- bool
 The item to get or set.
Exceptions
GetPendingItems(int)
Gets the list of pending items for a given transaction index.
protected override IEnumerable<KeyValuePair<TKey, TValue>> GetPendingItems(int currentTransaction)
  Parameters
currentTransactionint
Returns
- IEnumerable<KeyValuePair<TKey, TValue>>
 
GetValues()
Gets the values stored including unsaved.
public KeyValuePair<TKey, TValue>[] GetValues()
  Returns
- KeyValuePair<TKey, TValue>[]
 Values stored including unsaved.
RemoveUnsaved(KeyValuePair<TKey, TValue>, int)
Removes a value that has not yet been saved (pending state).
protected override void RemoveUnsaved(KeyValuePair<TKey, TValue> item, int currentTransaction)
  Parameters
itemKeyValuePair<TKey, TValue>The item.
currentTransactionint
ResetInternal()
Resets the store to an empty state, to be implemented by subclasses if necessary.
protected override void ResetInternal()
  SearchValues(Func<KeyValuePair<TKey, TValue>, bool>)
public IEnumerable<KeyValuePair<TKey, TValue>> SearchValues(Func<KeyValuePair<TKey, TValue>, bool> predicate)
  Parameters
predicateFunc<KeyValuePair<TKey, TValue>, bool>
Returns
- IEnumerable<KeyValuePair<TKey, TValue>>
 
TryGetValue(TKey, out TValue)
Tries to get the value from its key.
public bool TryGetValue(TKey key, out TValue value)
  Parameters
keyTKeyThe key.
valueTValueThe value.