Contains a set of metadata with flexible runtime conversion methods. Metadata keys are case-insensitive.
- Namespace
- Statiq
.Common - Interfaces
-
- IReadOnlyDictionary
<string, object> - IReadOnlyCollection
<KeyValuePair <string, object> > - IEnumerable
<KeyValuePair <string, object> > - IEnumerable
- IReadOnlyDictionary
- Implementing Types
-
- TestExecutionContext
- TestDocument
- MetadataDictionary
- TestMetadata
- IReadOnlySettings
- ISettings
- FilteredMetadata
- ObjectDocument
<T> - TestAnalyzerContext
- Metadata
- IDocument
- ConvertingDictionary
- IAnalyzerContext
- IExecutionContext
- Document
- Settings
- Document
<TDocument> - Read
Only Converting Dictionary - IMetadataDictionary
graph BT
Type-.->Interface0["IReadOnlyDictionary<string, object>"]
Type-.->Interface1["IReadOnlyCollection<KeyValuePair<string, object>>"]
Type-.->Interface2["IEnumerable<KeyValuePair<string, object>>"]
Type-.->Interface3["IEnumerable"]
Type["IMetadata"]
class Type type-node
Implementing0["TestExecutionContext"]-.->Type
click Implementing0 "/api/Statiq.Testing/TestExecutionContext"
Implementing1["TestDocument"]-.->Type
click Implementing1 "/api/Statiq.Testing/TestDocument"
Implementing2["MetadataDictionary"]-.->Type
click Implementing2 "/api/Statiq.Common/MetadataDictionary"
Implementing3["TestMetadata"]-.->Type
click Implementing3 "/api/Statiq.Testing/TestMetadata"
Implementing4["IReadOnlySettings"]-.->Type
click Implementing4 "/api/Statiq.Common/IReadOnlySettings"
Implementing5["ISettings"]-.->Type
click Implementing5 "/api/Statiq.Common/ISettings"
Implementing6["FilteredMetadata"]-.->Type
click Implementing6 "/api/Statiq.Common/FilteredMetadata"
Implementing7["ObjectDocument<T>"]-.->Type
click Implementing7 "/api/Statiq.Common/ObjectDocument_1"
Implementing8["TestAnalyzerContext"]-.->Type
click Implementing8 "/api/Statiq.Testing/TestAnalyzerContext"
Implementing9["Metadata"]-.->Type
click Implementing9 "/api/Statiq.Common/Metadata"
Implementing10["IDocument"]-.->Type
click Implementing10 "/api/Statiq.Common/IDocument"
Implementing11["ConvertingDictionary"]-.->Type
click Implementing11 "/api/Statiq.Common/ConvertingDictionary"
Implementing12["IAnalyzerContext"]-.->Type
click Implementing12 "/api/Statiq.Common/IAnalyzerContext"
Implementing13["IExecutionContext"]-.->Type
click Implementing13 "/api/Statiq.Common/IExecutionContext"
Implementing14["Document"]-.->Type
click Implementing14 "/api/Statiq.Common/Document"
Implementing15["Settings"]-.->Type
click Implementing15 "/api/Statiq.Common/Settings"
Implementing16["Document<TDocument>"]-.->Type
click Implementing16 "/api/Statiq.Common/Document_1"
Implementing17["ReadOnlyConvertingDictionary"]-.->Type
click Implementing17 "/api/Statiq.Common/ReadOnlyConvertingDictionary"
Implementing18["IMetadataDictionary"]-.->Type
click Implementing18 "/api/Statiq.Common/IMetadataDictionary"
Syntax
[TypeConverter(typeof(IMetadataToIDocumentTypeConverter))]
public interface IMetadata : IReadOnlyDictionary<string, object>,
IReadOnlyCollection<KeyValuePair<string, object>>, IEnumerable<KeyValuePair<string, object>>,
IEnumerable
Attributes
Type | Description |
---|---|
TypeConverter |
Methods
Name | Return Value | Summary |
---|---|---|
GetRawEnumerator |
IEnumerator |
Enumerates raw key-value pairs
(I.e., the values have not been expanded similar to
TryGetRaw(string, object) ).
|
TryGetRaw |
bool |
Tries to get the raw value for the specified key. This method will not materialize
IMetadataValue
values or process script strings the way the TryGetValue<TValue>(IMetadata, string, TValue) extension
and other get methods will. A System.Collections.Generic.KeyNotFoundException will be thrown for missing keys.
|
Extension Methods
Name | Value | Summary |
---|---|---|
Concat |
IEnumerable |
|
ContainsAnyKeys |
bool |
Determines whether the dictionary contains all the specified keys.
|
ContainsAnyKeys |
bool |
Determines whether the dictionary contains all the specified keys.
|
ContainsKeys |
bool |
Determines whether the dictionary contains all the specified keys.
|
ContainsKeys |
bool |
Determines whether the dictionary contains all the specified keys.
|
FilterMetadata |
IMetadata |
Gets a new filtered
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.
|
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 or is
null .
|
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 or is
null .
|
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,
is
null , or the value cannot be converted to T.
|
GetBool |
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.
|
GetDateTime |
DateTime |
Gets the value for the specified key converted to a
DateTime . This method never throws an exception. It will return the specified
default value if the key is not found.
|
GetDateTimeOffset |
DateTimeOffset |
Gets the value for the specified key converted to a
DateTimeOffset . This method never throws an exception. It will return the specified
default value if the key is not found.
|
GetDocument |
IDocument |
Gets the value for the specified key converted to a
IDocument . This method never throws an exception.
It will return null if the key is not found.
|
GetDocumentList |
DocumentList |
Gets the value for the specified key converted to a
DocumentList<TDocument> . This method never throws an exception.
It will return an empty list if the key is not found or if the key is found but contains no items that can be converted to IDocument .
|
GetDocumentList |
DocumentList |
Gets the value for the specified key converted to a
DocumentList<TDocument> . This method never throws an exception.
It will return an empty list if the key is not found or if the key is found but contains no items that can be converted to the specified document type.
|
GetDocuments |
IEnumerable |
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 IDocument .
|
GetDocuments |
IEnumerable |
Gets the value for the specified key converted to a
IReadOnlyList<TDocument> . 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 the specified document type.
|
GetDynamic |
dynamic |
Gets the value associated with the specified key as a dynamic object. This is equivalent
to calling
as dynamic to cast the value.
|
GetEnumerable |
IEnumerable |
Gets an enumerable that enumerates key-value pairs.
|
GetInt |
int |
Gets the value for the specified key converted to an int. This method never throws an exception. It will return the specified
default value if the key is not found.
|
GetList |
IReadOnlyList |
Gets the value for the specified key converted to a
IReadOnlyList<T> . 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.
|
GetMetadata |
IMetadata |
Gets the value for the specified key converted to a nested
IMetadata . This method never throws an exception.
It will return null if the key is not found.
|
GetNext |
T | |
GetNext |
T | |
GetPath |
NormalizedPath |
Gets the value for the specified key converted to a
NormalizedPath . This method never throws an exception.
It will return the specified default value if the key is not found.
|
GetPrevious |
T | |
GetPrevious |
T | |
GetRaw |
object |
Gets the raw value for the specified key. This method will not materialize
IMetadataValue
values the way other get methods will. A System.Collections.Generic.KeyNotFoundException will be thrown
for missing keys.
|
GetRawEnumerable |
IEnumerable |
Gets an enumerable that enumerates raw key-value pairs
(I.e., the values have not been expanded similar to
TryGetRaw(string, object) ).
|
GetString |
string |
Formats a string value if it exists in the metadata, otherwise returns a default value.
|
GetString |
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.
|
GroupByMany |
IEnumerable |
Groups the elements of a sequence according to a specified key selector function
that returns a sequence of keys.
The keys are compared by using a comparer and each group's elements
are projected by using a specified function.
From GroupByExtensions
|
GroupByMany |
IEnumerable |
Groups the elements of a sequence according to a specified key selector function
that returns a sequence of keys
and projects the elements for each group by using a specified function.
From GroupByExtensions
|
GroupByMany |
IEnumerable |
Groups the elements of a sequence according to a specified key selector function
that returns a sequence of keys
and compares the keys by using a specified comparer.
From GroupByExtensions
|
GroupByMany |
IEnumerable |
Groups the elements of a sequence according to a specified key selector function
that returns a sequence of keys.
From GroupByExtensions
|
GroupByManyToMany |
IEnumerable |
Groups the elements of a sequence according to a specified key selector function
that returns a sequence of keys.
The keys are compared by using a comparer and each group's elements
are projected by using a specified function
that returns a sequence of elements.
From GroupByExtensions
|
GroupByManyToMany |
IEnumerable |
Groups the elements of a sequence according to a specified key selector function
that returns a sequence of keys
and projects the elements for each group by using a specified function
that returns a sequence of elements.
From GroupByExtensions
|
ParallelForEachAsync |
Task | |
ParallelSelectAsync |
Task |
Invokes an async selector in parallel.
|
Parallel |
Task |
Invokes an async selector that returns multiple results in parallel.
|
ParallelWhereAsync |
Task |
|
RequireKeys |
void |
Verifies that a dictionary contains all requires keys.
An
System.ArgumentException will be thrown if the
specified keys are not all present in the dictionary.
|
RequireKeys |
void |
Verifies that a dictionary contains all requires keys.
An
System.ArgumentException will be thrown if the
specified keys are not all present in the dictionary.
|
StartsWith |
bool |
Determines whether the items starts with the specified values.
|
StartsWith |
bool |
Determines whether the items starts with the specified values.
|
ThrowIfNull |
T |
From GuardExtensions
|
ToDocument |
IDocument | |
ToDocument |
IDocument | |
ToDocument |
IDocument | |
ToDocument |
IDocument | |
ToDocument |
IDocument | |
ToDocument |
IDocument | |
ToDocuments |
IEnumerable |
|
ToDocuments |
IEnumerable |
|
ToDocuments |
IEnumerable |
|
ToDocuments |
IEnumerable |
|
ToDocuments |
IEnumerable |
|
ToDocuments |
IEnumerable |
|
ToJson |
string | |
ToLookupMany |
ILookup |
Creates a lookup from a sequence according to a specified key selector function
that returns a sequence of keys.
The keys are compared by using a comparer and each group's elements
are projected by using a specified function.
From ToLookupExtensions
|
ToLookupMany |
ILookup |
Creates a lookup from a sequence according to a specified key selector function
that returns a sequence of keys
and projects the elements for each group by using a specified function.
From ToLookupExtensions
|
ToLookupMany |
ILookup |
Creates a lookup from a sequence according to a specified key selector function
that returns a sequence of keys
and compares the keys by using a specified comparer.
From ToLookupExtensions
|
ToLookupMany |
ILookup |
Creates a lookup from a sequence according to a specified key selector function
that returns a sequence of keys.
From ToLookupExtensions
|
ToLookupManyToMany |
ILookup |
Creates a lookup from a sequence according to a specified key selector function
that returns a sequence of keys.
The keys are compared by using a comparer and each group's elements
are projected by using a specified function
that returns a sequence of elements.
From ToLookupExtensions
|
ToLookupManyToMany |
ILookup |
Creates a lookup from a sequence according to a specified key selector function
that returns a sequence of keys
and projects the elements for each group by using a specified function
that returns a sequence of elements.
From ToLookupExtensions
|
ToStringTable |
string | |
TryGetValue |
bool |
Tries to get the value for the specified key.
|
WithoutSettings |
IMetadata | |
XAttribute |
XAttribute | |
XAttribute |
XAttribute | |
XAttribute |
XAttribute | |
XAttribute |
XAttribute |
Gets an XML attribute for the given metadata key.
|
XAttribute |
XAttribute |
Gets an XML attribute for the given metadata key.
The name of the attribute will be the lower-case key name.
|
XElement |
XElement | |
XElement |
XElement | |
XElement |
XElement |