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<string, Object>
Implementing Types
graph BT Type-.->Interface0["IMetadata"] click Interface0 "/api/Wyam.Common.Meta/IMetadata" Type-.->Interface1["IReadOnlyDictionary<string, Object>"] Type["IExecutionContext"] class Type type-node Implementing0["TestExecutionContext"]-.->Type click Implementing0 "/api/Wyam.Testing.Execution/TestExecutionContext"

Syntax

public interface IExecutionContext : IMetadata, IReadOnlyDictionary<string, Object>

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<byte[]>
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<string>
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.
Shortcodes IReadOnlyShortcodeCollection
Gets the available shortcodes.

Methods

Name Value Summary
CreateHttpClient() HttpClient
Creates a System.Net.Http.HttpClient instance that should be used for all HTTP communication.
CreateHttpClient(HttpMessageHandler) HttpClient
Creates a new System.Net.Http.HttpClient instance that uses a custom message handler.
Execute(IEnumerable<IModule>, IEnumerable<IDocument>) IReadOnlyList<IDocument>
Executes the specified modules with the specified input documents and returns the result documents.
Execute(IEnumerable<IModule>, IEnumerable<KeyValuePair<string, Object>>) IReadOnlyList<IDocument>
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<IDocument>
Executes the specified modules with an empty initial input document with optional additional metadata and returns the result documents.
GetContentStream(string) Stream
Gets a System.IO.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, IEnumerable<KeyValuePair<string, Object>>) IDocument
Gets a new document with the specified source and metadata (in addition to the 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 System.IO.Stream will automatically be disposed when the document is disposed (I.e., the document takes ownership of the System.IO.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 System.IO.Stream will automatically be disposed when the document is disposed (I.e., the document takes ownership of the System.IO.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 System.IO.Stream will automatically be disposed when the document is disposed (I.e., the document takes ownership of the System.IO.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 System.IO.Stream will automatically be disposed when the document is disposed (I.e., the document takes ownership of the System.IO.Stream).
GetJavaScriptEnginePool(Action<IJavaScriptEngine>, int, int, int, Nullable<TimeSpan>) IJavaScriptEnginePool
Gets a new Wyam.Common.JavaScript.IJavaScriptEnginePool. The returned engine pool should be disposed when no longer needed.
GetShortcodeResult(Stream, IEnumerable<KeyValuePair<string, Object>>) IShortcodeResult
A factory method for use from inside an Wyam.Common.Shortcodes.IShortcode to create an Wyam.Common.Shortcodes.IShortcodeResult.
GetShortcodeResult(string, IEnumerable<KeyValuePair<string, Object>>) IShortcodeResult
A factory method for use from inside an Wyam.Common.Shortcodes.IShortcode to create an Wyam.Common.Shortcodes.IShortcodeResult.
TryConvert<T>(Object, T) bool
Provides access to the same enhanced type conversion used to convert metadata types.

Extension Methods

Name Value Summary
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 System.Globalization.CultureInfo for the date display culture.
GetDateTimeInputCulture() CultureInfo
Gets the System.Globalization.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, bool) HtmlString
GetTypeLink(IMetadata, string) HtmlString
GetTypeLink(IMetadata, string, bool) 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.
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