CustomDocument Class

Summary

Derive custom document types from this class to get built-in support.
Assembly
Wyam.Core.dll
Namespace
Wyam.Core.Documents
Interfaces
Base Types
  • Object
graph BT Type-->Base0["Object"] Type-.->Interface0["IDocument"] click Interface0 "/api/Wyam.Common.Documents/IDocument" Type-.->Interface1["IMetadata"] click Interface1 "/api/Wyam.Common.Meta/IMetadata" Type-.->Interface2["IReadOnlyDictionary<string, Object>"] Type-.->Interface3["IDisposable"] Type["CustomDocument"] class Type type-node

Syntax

public abstract class CustomDocument : IDocument, IMetadata, IReadOnlyDictionary<string, Object>, 
    IDisposable

Properties

Name Value Summary
Content string
Gets the content associated with this document as a string. This will result in reading the entire content stream.
Count int
Id string
An identifier that is generated when the document is created and stays the same after cloning.
Keys IEnumerable<string>
Metadata IMetadata
Gets the metadata associated with this document.
Source FilePath
An identifier for the document meant to reflect the source of the data. These should be unique (such as a file name).
this[string] Object
Values IEnumerable<Object>
WithoutSettings IMetadata
Gets the metadata for this document without any global settings included.

Methods

Name Value Summary
ContainsKey(string) bool
Dispose() void
Get(string, Object) Object
Gets the value for the specified key. This method never throws an exception. It will return the specified default value or null if the key is not found.
Get<T>(string) T
Gets the value for the specified key converted to the specified type. This method never throws an exception. It will return default(T) if the key is not found or the value cannot be converted to T.
Get<T>(string, T) T
Gets the value for the specified key. This method never throws an exception. It will return the specified default value if the key is not found.
GetEnumerator() IEnumerator<KeyValuePair<string, Object>>
GetMetadata(string[]) IMetadata
Gets a new Wyam.Common.Meta.IMetadata containing only the specified keys and their values. If a key is not present in the current metadata, it will be ignored and will not be copied to the new metadata object.
GetRaw(string) Object
Gets the raw value for the specified key. This method will not materialize Wyam.Common.Meta.IMetadataValue values the way Wyam.Common.Meta.IMetadata.Get(System.String,System.Object) will. A System.Collections.Generic.KeyNotFoundException will be thrown for missing keys.
GetStream() Stream
Gets the content associated with this document as a System.IO.Stream. The underlying stream will be reset to position 0 each time this method is called. The stream you get from this call must be disposed as soon as reading is complete. Other threads will block on this call until the previously returned stream is disposed.
MetadataAs<T>() IMetadata<T>
Presents metadata values as a specific type (see Wyam.Common.Meta.IMetadata).
SourceString() string
Gets a string representation of the source that's guaranteed non-null, used primarily for trace messages.
TryGetValue(string, Object) bool
TryGetValue<T>(string, T) bool
Tries to get the value for the specified key.
GitHub