Class EffectiveConfigSettingZptDocumentRendererDecorator
An entry-point service for ZPT-Sharp. This service renders a model to a document stream and returns the result as a stream.
Inheritance
Implements
Inherited Members
Namespace: ZptSharp.Rendering
Assembly: ZptSharp.dll
Syntax
public class EffectiveConfigSettingZptDocumentRendererDecorator : IRendersZptDocument
Remarks
Use this service when you wish to perform the ZPT rendering process upon a System.IO.Stream. That stream may have come from any source (not neccesarily a file on disk).
If you wish to render a file on disk, then you should probably consider using ZptFileRenderer (IRendersZptFile) instead, which provides an API which is more suitable for files, including choosing a rendering backend based upon the file extension.
Constructors
| Improve this Doc View SourceEffectiveConfigSettingZptDocumentRendererDecorator(IRendersZptDocument, Type)
Initializes a new instance of the EffectiveConfigSettingZptDocumentRendererDecorator class.
Declaration
public EffectiveConfigSettingZptDocumentRendererDecorator(IRendersZptDocument wrapped, Type readerWriterType = null)
Parameters
Type | Name | Description |
---|---|---|
IRendersZptDocument | wrapped | The wrapped implementation type. |
System.Type | readerWriterType | Indicates the document provider implementation type to use for rendering the current document. |
Remarks
If a readerWriterType
is specified in this constructor, then the
DocumentProviderType specified in
RenderAsync(Stream, Object, RenderingConfig, CancellationToken, IDocumentSourceInfo)
will not be used. The document provider (aka document reader/writer) provided in
this constructor will be used instead.
Methods
| Improve this Doc View SourceRenderAsync(Stream, Object, RenderingConfig, CancellationToken, IDocumentSourceInfo)
Renders a specified ZPT document from a stream using the specified model.
Declaration
public Task<Stream> RenderAsync(Stream stream, object model, RenderingConfig config = null, CancellationToken token = default(CancellationToken), IDocumentSourceInfo sourceInfo = null)
Parameters
Type | Name | Description |
---|---|---|
System.IO.Stream | stream | The stream containing the document to render. |
System.Object | model | The model to use for the rendering process. |
RenderingConfig | config | An optional rendering configuration object. |
System.Threading.CancellationToken | token | An object used to cancel the operation if required. |
IDocumentSourceInfo | sourceInfo | The source info for the |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.IO.Stream> | A stream containing the rendered document. |
Remarks
There are two ways in which an implementation of IReadsAndWritesDocument
(aka "the document provider") may be specified for use when executing this method.
One way is to specify a non-null config
which has its
DocumentProviderType configuration option set.
The other way is to specify a non-null instance of IReadsAndWritesDocument
in the constructor of this EffectiveConfigSettingZptDocumentRendererDecorator instance.
If both mechanisms are specified, then the document provider specified via the EffectiveConfigSettingZptDocumentRendererDecorator will take precedence (ignoring the reader/writer specified in the configuration).