Table of Contents

InMemoryTargetDictionary Class

Definition

Namespace
Sandcastle.Tools.BuildComponents.Targets
Assembly
Sandcastle.Tools.BuildComponents.dll

This contains a collection of targets indexed by member ID stored in a simple ConcurrentDictionary<TKey, TValue> entirely in memory.

[Serializable]
public sealed class InMemoryTargetDictionary : TargetDictionary, IDictionary<string, Target>, ICollection<KeyValuePair<string, Target>>, IEnumerable<KeyValuePair<string, Target>>, IEnumerable, IDisposable
Inheritance
InMemoryTargetDictionary
Implements

Remarks

The behavior of this dictionary is to return null if a target ID is not found and to replace existing entries if a duplicate ID is added. All targets are stored in memory. Since it must load all targets the first time the files are encountered, it can slow down initialization. The trade off is that it can run faster than database-backed implementations that look up the items rather than storing them in memory.

This implementation does not offer the option for a persistent cache as streaming the entire dictionary in and out takes several times longer than just loading the source XML data.

Constructors

InMemoryTargetDictionary(BuildComponentCore, XPathNavigator)

Constructor

Properties

BuildComponent

This read-only property returns the build component that owns the target dictionary

(Inherited from TargetDictionary)
Count
DictionaryId

This is used to get or set the target dictionary's unique ID

(Inherited from TargetDictionary)
DirectoryPath

This is used to get or set the path to the target files

(Inherited from TargetDictionary)
FilePattern

This is used to get or set the file pattern to use when searching for target files

(Inherited from TargetDictionary)
IsDisposed

This read-only property can be used to determine whether or not the target dictionary has been disposed.

(Inherited from TargetDictionary)
IsReadOnly (Inherited from TargetDictionary)
Keys
NamespaceFileFilter

This read-only property returns any optional namespace files used to filter what gets loaded

(Inherited from TargetDictionary)
Recurse

This is used to get or set whether to recurse into subfolders of DirectoryPath when loading target files.

(Inherited from TargetDictionary)
this[string]
Values

Methods

Add(KeyValuePair<string, Target>)
Add(string, Target)
Clear()
Contains(KeyValuePair<string, Target>)
ContainsKey(string)
CopyTo(KeyValuePair<string, Target>[], int)
Dispose()

This implements the Dispose() interface to properly dispose of the target dictionary

(Inherited from TargetDictionary)
GetEnumerator()
ReportCacheStatistics()

This can be overridden in derived classes to report cache usage statistics after the build

(Inherited from TargetDictionary)
TryGetValue(string, out Target)