Summary
Contains a set of metadata with flexible runtime conversion methods. Metadata keys are case-insensitive.
- Assembly
- Wyam
.Common .dll - Namespace
- Wyam
.Common .Meta - Interfaces
-
- IReadOnlyDictionary
<string, Object>
- IReadOnlyDictionary
- Implementing Types
graph BT
Type-.->Interface0["IReadOnlyDictionary<string, Object>"]
Type["IMetadata"]
class Type type-node
Implementing0["TestSettings"]-.->Type
click Implementing0 "/api/Wyam.Testing.Configuration/TestSettings"
Implementing1["TestDocument"]-.->Type
click Implementing1 "/api/Wyam.Testing.Documents/TestDocument"
Implementing2["IDocument"]-.->Type
click Implementing2 "/api/Wyam.Common.Documents/IDocument"
Implementing3["IMetadataDictionary"]-.->Type
click Implementing3 "/api/Wyam.Common.Meta/IMetadataDictionary"
Implementing4["TestMetadata"]-.->Type
click Implementing4 "/api/Wyam.Testing.Meta/TestMetadata"
Implementing5["CustomDocument"]-.->Type
click Implementing5 "/api/Wyam.Core.Documents/CustomDocument"
Implementing6["IReadOnlySettings"]-.->Type
click Implementing6 "/api/Wyam.Common.Configuration/IReadOnlySettings"
Implementing7["IExecutionContext"]-.->Type
click Implementing7 "/api/Wyam.Common.Execution/IExecutionContext"
Implementing8["ConvertingDictionary"]-.->Type
click Implementing8 "/api/Wyam.Common.Meta/ConvertingDictionary"
Implementing9["ISettings"]-.->Type
click Implementing9 "/api/Wyam.Common.Configuration/ISettings"
Implementing10["TestExecutionContext"]-.->Type
click Implementing10 "/api/Wyam.Testing.Execution/TestExecutionContext"
Syntax
public interface IMetadata : IReadOnlyDictionary<string, Object>
Methods
Name | Value | Summary |
---|---|---|
Get |
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 |
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 |
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.
|
GetMetadata |
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 |
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.
|
MetadataAs |
IMetadata |
Presents metadata values as a specific type (see
Wyam.Common.Meta.IMetadata ).
|
TryGetValue |
bool |
Tries to get the value for the specified key.
|
Extension Methods
Name | Value | Summary |
---|---|---|
Bool |
bool |
Gets the value for the specified key converted to a bool. This method never throws an exception. It will return the specified
default value if the key is not found.
|
DateTime |
DateTime |
Gets the value for the specified key converted to a
Wyam.Common.Meta.MetadataConversionExtensions.DateTime(Wyam.Common.Meta.IMetadata,System.String,System.DateTime) . This method never throws an exception. It will return the specified
default value if the key is not found.
|
DirectoryPath |
DirectoryPath |
Gets the value for the specified key converted to a
Wyam.Common.Meta.MetadataConversionExtensions.DirectoryPath(Wyam.Common.Meta.IMetadata,System.String,Wyam.Common.IO.DirectoryPath) . This method never throws an exception. It will
return the specified default value if the key is not found or if the string value can't be converted to a Wyam.Common.Meta.MetadataConversionExtensions.DirectoryPath(Wyam.Common.Meta.IMetadata,System.String,Wyam.Common.IO.DirectoryPath) .
|
Document |
IDocument |
Gets the value for the specified key converted to a
Wyam.Common.Documents.IDocument . This method never throws an exception.
It will return null if the key is not found.
|
DocumentList |
IReadOnlyList |
Gets the value for the specified key converted to a
IReadOnlyList<IDocument> . This method never throws an exception.
It will return null if the key is not found and an empty list if the key is found but contains no items that can be converted to Wyam.Common.Documents.IDocument .
|
Dynamic |
dynamic |
Gets the value associated with the specified key as a dynamic object. This is equivalent
to calling
as dynamic to cast the value.
|
FilePath |
FilePath |
Gets the value for the specified key converted to a
Wyam.Common.Meta.MetadataConversionExtensions.FilePath(Wyam.Common.Meta.IMetadata,System.String,Wyam.Common.IO.FilePath) . This method never throws an exception. It will
return the specified default value if the key is not found or if the string value can't be converted to a Wyam.Common.Meta.MetadataConversionExtensions.FilePath(Wyam.Common.Meta.IMetadata,System.String,Wyam.Common.IO.FilePath) .
|
List |
IReadOnlyList |
Gets the value for the specified key converted to a
System.Collections.Generic.IReadOnlyList`1 . This method never throws an exception. It will return the specified
default value if the key is not found. Note that if the value is atomic, the conversion operation will succeed and return a list with one item.
|
Name |
HtmlString |
From Extensions
|
String |
string |
Formats a string value if it exists in the metadata, otherwise returns a default value.
|
String |
string |
Gets the value for the specified key converted to a string. This method never throws an exception. It will return the specified
default value if the key is not found.
|
XAttribute |
XAttribute |
Gets an XML attribute for the given metadata key.
The name of the attribute will be the lower-case key name.
|
XAttribute |
XAttribute | |
XAttribute |
XAttribute | |
XAttribute |
XAttribute |
Gets an XML attribute for the given metadata key.
|
XAttribute |
XAttribute | |
XElement |
XElement | |
XElement |
XElement | |
XElement |
XElement |