IExecutionContext Interface

Summary

All of the information that represents a given build. Also implements Wyam.Common.Meta.IMetadata to expose the global metadata.
Assembly
Wyam.Common.dll
Namespace
Wyam.Common.Execution
Interfaces
  • IMetadata
  • IReadOnlyDictionary<TKey, TValue>
  • IReadOnlyCollection<T>
  • IEnumerable<T>
  • IEnumerable
Implementing Types
graph TD Interface0["IMetadata"]-.->Type click Interface0 "/api/Wyam.Common.Meta/IMetadata" Interface1["IReadOnlyDictionary<TKey, TValue>"]-.->Type Interface2["IReadOnlyCollection<T>"]-.->Type Interface3["IEnumerable<T>"]-.->Type Interface4["IEnumerable"]-.->Type Type["IExecutionContext"] class Type type-node Type-.->Implementing0["TestExecutionContext"] click Implementing0 "/api/Wyam.Testing.Execution/TestExecutionContext"

Syntax

public interface IExecutionContext : IMetadata, IReadOnlyDictionary<string, object>, 
    IReadOnlyCollection<KeyValuePair<string, object>>, IEnumerable<KeyValuePair<string, object>>, 
    IEnumerable

Properties

Name Value Summary
ApplicationInput string
Gets any input that was passed to the application (for example, on stdin via piping).
Documents IDocumentCollection
Gets the collection of all previously processed documents.
DynamicAssemblies IReadOnlyCollection<T>
Gets the raw bytes for dynamically compiled assemblies (such as the configuration script).
ExecutionCache IExecutionCache
Gets the current execution cache. Modules can use the cache to store data between executions.
ExecutionId Guid
Uniquly identifies the current execution cycle. This can be used to initialize and/or reset static data for a module on new generations (I.e., due to watching). For example, cache data could be cleared when this changes between runs.
FileSystem IReadOnlyFileSystem
Gets the current file system.
Module IModule
Gets the currently executing module.
Namespaces IReadOnlyCollection<T>
Gets a set of namespaces that should be brought into scope for modules that perform dynamic compilation.
Pipeline IReadOnlyPipeline
Gets the currently executing pipeline.
Settings IReadOnlySettings
Gets the current settings metadata.

Methods

Name Value Summary
Execute(IEnumerable<IModule>, IEnumerable<IDocument>) IReadOnlyList<T>
Executes the specified modules with the specified input documents and returns the result documents.
Execute(IEnumerable<IModule>, IEnumerable<KeyValuePair<string, object>>) IReadOnlyList<T>
Executes the specified modules with an empty initial input document with optional additional metadata and returns the result documents.
Execute(IEnumerable<IModule>, IEnumerable<MetadataItem>) IReadOnlyList<T>
Executes the specified modules with an empty initial input document with optional additional metadata and returns the result documents.
GetContentStream(string) Stream
Gets a Stream that can be used for document content. If content is not null, the stream is initialized with the specified content. It is prefered to use this method to obtain a stream over creating your own if the source of the content does not already provide one. The returned streams are optimized for memory usage and performance. The position is set to the beginning of the stream when returned.
GetDocument() IDocument
Gets a new document with default initial metadata.
GetDocument(FilePath, Stream, IEnumerable<KeyValuePair<string, object>>, bool) IDocument
Gets a new document with the specified source, content stream, and metadata (in addition to the default initial metadata). If disposeStream is true (which it is by default), the provided Stream will automatically be disposed when the document is disposed (I.e., the document takes ownership of the Stream).
GetDocument(IDocument, FilePath, IEnumerable<KeyValuePair<string, object>>) IDocument
Clones the specified source document with a new source and additional metadata (all existing metadata is retained) or gets a new document if the source document is null or AsNewDocuments() was called on the module.
GetDocument(IDocument, FilePath, Stream, IEnumerable<KeyValuePair<string, object>>, bool) IDocument
Clones the specified source document with a new source, new content stream, and additional metadata (all existing metadata is retained) or gets a new document if the source document is null or AsNewDocuments() was called on the module. If disposeStream is true (which it is by default), the provided Stream will automatically be disposed when the document is disposed (I.e., the document takes ownership of the Stream).
GetDocument(IDocument, IEnumerable<KeyValuePair<string, object>>) IDocument
Clones the specified source document with identical content and additional metadata (all existing metadata is retained) or gets a new document if the source document is null or AsNewDocuments() was called on the module.
GetDocument(IDocument, Stream, IEnumerable<KeyValuePair<string, object>>, bool) IDocument
Clones the specified source document with a new content stream, and additional metadata (all existing metadata is retained) or gets a new document if the source document is null or AsNewDocuments() was called on the module. If disposeStream is true (which it is by default), the provided Stream will automatically be disposed when the document is disposed (I.e., the document takes ownership of the Stream).
GetDocument(IEnumerable<KeyValuePair<string, object>>) IDocument
Gets a new document with the specified metadata (in addition to the default initial metadata).
GetDocument(Stream, IEnumerable<KeyValuePair<string, object>>, bool) IDocument
Gets a new document with the specified content stream and metadata (in addition to the default initial metadata). If disposeStream is true (which it is by default), the provided Stream will automatically be disposed when the document is disposed (I.e., the document takes ownership of the Stream).
GetJsEnginePool(Action<IJsEngine>, int, int, int, TimeSpan?) IJsEnginePool
Gets a new Wyam.Common.JavaScript.IJsEnginePool. The returned engine pool should be disposed when no longer needed.
TryConvert<T>(object, T) bool
Provides access to the same enhanced type conversion used to convert metadata types.

Extension Methods

Name Value Summary
Bool(string, 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(string, 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(string, 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(string, IDocument) 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(string, IReadOnlyList<IDocument>) IReadOnlyList<T>
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(string, object) 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(string, 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).
ForEach(IEnumerable<IDocument>, Action<IDocument>) void
If an exception is thrown within the action, an error messages will be sent to the trace output containing information about the document source, the current module, and the exception message. The exception will also be re-thrown once the message has been sent to the trace listeners.
GenerateInfobarHeadings(IDocument) string
Generates links to each heading on a page and returns a string containing all of the links.
GetDateTimeDisplayCulture(string) CultureInfo
Gets the CultureInfo for the date display culture.
GetDateTimeInputCulture() CultureInfo
Gets the CultureInfo for the date input culture.
GetLink() string
Gets a link for the root of the site using the host and root path specified in the settings.
GetLink(IMetadata, bool) string
Gets a link for the specified metadata (typically a document) using the "RelativeFilePath" metadata value and the default settings from the Wyam.Common.Configuration.IReadOnlySettings. This version should be used inside modules to ensure consistent link generation. Note that you can optionally include the host or not depending on if you want to generate host-specific links. By default, the host is not included so that sites work the same on any server including the preview server.
GetLink(IMetadata, string, bool) string
Gets a link for the specified metadata (typically a document) using the specified metadata value (by default, "RelativeFilePath") and the default settings from the Wyam.Common.Configuration.IReadOnlySettings. This version should be used inside modules to ensure consistent link generation. Note that you can optionally include the host or not depending on if you want to generate host-specific links. By default, the host is not included so that sites work the same on any server including the preview server.
GetLink(NormalizedPath, bool) string
Converts the specified path into a string appropriate for use as a link using default settings from the Wyam.Common.Configuration.IReadOnlySettings. This version should be used inside modules to ensure consistent link generation. Note that you can optionally include the host or not depending on if you want to generate host-specific links. By default, the host is not included so that sites work the same on any server including the preview server.
GetLink(NormalizedPath, string, DirectoryPath, bool, bool, bool) string
Converts the path into a string appropriate for use as a link, overriding one or more settings from the Wyam.Common.Configuration.IReadOnlySettings.
GetLink(NormalizedPath, string, DirectoryPath, bool, bool, bool, bool) string
Converts the path into a string appropriate for use as a link, overriding one or more settings from the Wyam.Common.Configuration.IReadOnlySettings.
GetLink(string, bool) string
Converts the specified path into a string appropriate for use as a link using default settings from the Wyam.Common.Configuration.IReadOnlySettings. This version should be used inside modules to ensure consistent link generation. Note that you can optionally include the host or not depending on if you want to generate host-specific links. By default, the host is not included so that sites work the same on any server including the preview server.
GetLink(string, string, DirectoryPath, bool, bool, bool) string
Converts the path into a string appropriate for use as a link, overriding one or more settings from the Wyam.Common.Configuration.IReadOnlySettings.
GetTypeLink(IMetadata) HtmlString
GetTypeLink(IMetadata, HtmlString) HtmlString
GetTypeLink(IMetadata, string) HtmlString
GroupByMany<KeyValuePair<string, object>, TKey, TElement>(Func<KeyValuePair<string, object>, IEnumerable<TKey>>, Func<KeyValuePair<string, object>, TElement>) IEnumerable<T>
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.
GroupByMany<KeyValuePair<string, object>, TKey, TElement>(Func<KeyValuePair<string, object>, IEnumerable<TKey>>, Func<KeyValuePair<string, object>, TElement>, IEqualityComparer<TKey>) IEnumerable<T>
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.
GroupByMany<KeyValuePair<string, object>, TKey>(Func<KeyValuePair<string, object>, IEnumerable<TKey>>) IEnumerable<T>
Groups the elements of a sequence according to a specified key selector function that returns a sequence of keys.
GroupByMany<KeyValuePair<string, object>, TKey>(Func<KeyValuePair<string, object>, IEnumerable<TKey>>, IEqualityComparer<TKey>) IEnumerable<T>
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.
GroupByManyToMany<KeyValuePair<string, object>, TKey, TElement>(Func<KeyValuePair<string, object>, IEnumerable<TKey>>, Func<KeyValuePair<string, object>, IEnumerable<TElement>>) IEnumerable<T>
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.
GroupByManyToMany<KeyValuePair<string, object>, TKey, TElement>(Func<KeyValuePair<string, object>, IEnumerable<TKey>>, Func<KeyValuePair<string, object>, IEnumerable<TElement>>, IEqualityComparer<TKey>) IEnumerable<T>
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.
List<T>(string, IReadOnlyList<T>) IReadOnlyList<T>
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.
Name() HtmlString
ParallelForEach(IEnumerable<IDocument>, Action<IDocument>) void
If an exception is thrown within the action, an error messages will be sent to the trace output containing information about the document source, the current module, and the exception message. The exception will also be re-thrown once the message has been sent to the trace listeners.
String(string, 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.
ToLookupMany<KeyValuePair<string, object>, TKey, TElement>(Func<KeyValuePair<string, object>, IEnumerable<TKey>>, Func<KeyValuePair<string, object>, TElement>) 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.
ToLookupMany<KeyValuePair<string, object>, TKey, TElement>(Func<KeyValuePair<string, object>, IEnumerable<TKey>>, Func<KeyValuePair<string, object>, TElement>, IEqualityComparer<TKey>) 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.
ToLookupMany<KeyValuePair<string, object>, TKey>(Func<KeyValuePair<string, object>, IEnumerable<TKey>>) ILookup<,>
Creates a lookup from a sequence according to a specified key selector function that returns a sequence of keys.
ToLookupMany<KeyValuePair<string, object>, TKey>(Func<KeyValuePair<string, object>, IEnumerable<TKey>>, IEqualityComparer<TKey>) 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.
ToLookupManyToMany<KeyValuePair<string, object>, TKey, TElement>(Func<KeyValuePair<string, object>, IEnumerable<TKey>>, Func<KeyValuePair<string, object>, IEnumerable<TElement>>) 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.
ToLookupManyToMany<KeyValuePair<string, object>, TKey, TElement>(Func<KeyValuePair<string, object>, IEnumerable<TKey>>, Func<KeyValuePair<string, object>, IEnumerable<TElement>>, IEqualityComparer<TKey>) 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.
TraceExceptions(Action) void
If an exception is thrown within the action, an error messages will be sent to the trace output containing information about the current module and the exception message. The exception will also be re-thrown once the message has been sent to the trace listeners.
TraceExceptions(IDocument, Action<IDocument>) void
If an exception is thrown within the action, an error messages will be sent to the trace output containing information about the document source, the current module, and the exception message. The exception will also be re-thrown once the message has been sent to the trace listeners.
TraceExceptions<TResult>(Func<TResult>) TResult
If an exception is thrown within the action, an error messages will be sent to the trace output containing information about the current module and the exception message. The exception will also be re-thrown once the message has been sent to the trace listeners.
TraceExceptions<TResult>(IDocument, Func<IDocument, TResult>) TResult
If an exception is thrown within the action, an error messages will be sent to the trace output containing information about the document source, the current module, and the exception message. The exception will also be re-thrown once the message has been sent to the trace listeners.
TryParseInputDateTime(string, DateTime) bool
Attempts to parse and input date using the input date culture setting.
GitHub