/// <summary>
        /// Initializes a new instance of the <see cref="CSF.Zpt.Rendering.IRenderingSettings"/> class.
        /// </summary>
        /// <param name="addSourceFileAnnotation">Indicates whether or not source file annotation is to be added.</param>
        /// <param name="elementVisitors">The element visitors to use.</param>
        /// <param name="contextFactory">The rendering context factory.</param>
        /// <param name="outputEncoding">The desired output encoding.</param>
        /// <param name="omitXmlDeclaration">Whether or not to omit the XML declaration.</param>
        /// <param name="documentFactory">An optional non-default implementation of <see cref="ITemplateFileFactory"/> to use.</param>
        public RenderingSettings(IContextVisitor[] elementVisitors,
                             IRenderingContextFactory contextFactory,
                             bool addSourceFileAnnotation,
                             System.Text.Encoding outputEncoding,
                             bool omitXmlDeclaration,
                             ITemplateFileFactory documentFactory)
        {
            if(elementVisitors == null)
              {
            throw new ArgumentNullException(nameof(elementVisitors));
              }
              if(contextFactory == null)
              {
            throw new ArgumentNullException(nameof(contextFactory));
              }
              if(outputEncoding == null)
              {
            throw new ArgumentNullException(nameof(outputEncoding));
              }
              if(documentFactory == null)
              {
            throw new ArgumentNullException(nameof(documentFactory));
              }

              _contextVisitors = elementVisitors;
              this.ContextFactory = contextFactory;
              this.AddSourceFileAnnotation = addSourceFileAnnotation;
              this.OutputEncoding = outputEncoding;
              this.OmitXmlDeclaration = omitXmlDeclaration;
              this.TemplateFileFactory = documentFactory;
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="CSF.Zpt.Tales.BuiltinContextsContainer"/> class.
        /// </summary>
        /// <param name="options">Options.</param>
        /// <param name="repeat">Repeat.</param>
        /// <param name="attrs">Attrs.</param>
        /// <param name="templateFileFactory">A template-file factory.</param>
        /// <param name="model">The model being rendered.</param>
        public BuiltinContextsContainer(NamedObjectWrapper options,
                                    RepetitionMetadataCollectionWrapper repeat,
                                    Lazy<OriginalAttributeValuesCollection> attrs,
                                    ITemplateFileFactory templateFileFactory,
                                    object model = null)
        {
            if(options == null)
              {
            throw new ArgumentNullException(nameof(options));
              }
              if(repeat == null)
              {
            throw new ArgumentNullException(nameof(repeat));
              }
              if(attrs == null)
              {
            throw new ArgumentNullException(nameof(attrs));
              }

              _nothing = null;
              _default = ZptConstants.CancellationToken;
              _options = options;
              _repeat = repeat;
              _attrs = attrs;
              _model = model;

            _templateFileFactory = templateFileFactory;
        }
 public MvcContextsContainer(NamedObjectWrapper options,
                         RepetitionMetadataCollectionWrapper repeat,
                         Lazy<OriginalAttributeValuesCollection> attrs,
                         ViewContext viewContext,
                         ITemplateFileFactory templateFileFactory = null)
     : base(options, repeat, attrs, templateFileFactory, viewContext?.ViewData?.Model)
 {
     _viewContext = viewContext?? new ViewContext();
       _applicationDictionary = GetApplicationDictionary(viewContext);
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="CSF.Zpt.Rendering.DefaultRenderingSettings"/> class.
 /// </summary>
 /// <param name="documentFactory">Document factory.</param>
 /// <param name="elementVisitors">Element visitors.</param>
 /// <param name="contextFactory">Context factory.</param>
 /// <param name="addSourceFileAnnotation">If set to <c>true</c> add source file annotation.</param>
 /// <param name="outputEncoding">Output encoding.</param>
 /// <param name="omitXmlDeclaration">If set to <c>true</c> omit XML declaration.</param>
 protected DefaultRenderingSettings(ITemplateFileFactory documentFactory = null,
                                IContextVisitor[] elementVisitors = null,
                                IRenderingContextFactory contextFactory = null,
                                bool addSourceFileAnnotation = DefaultAddAnnotation,
                                Encoding outputEncoding = null,
                                bool omitXmlDeclaration = DefaultOmitXmlDeclaration)
 {
     this.TemplateFileFactory = documentFactory?? new ZptDocumentFactory();
       this.AddSourceFileAnnotation = addSourceFileAnnotation;
       this.OmitXmlDeclaration = omitXmlDeclaration;
       this.ContextVisitors = elementVisitors?? DefaultVisitors;
       this.ContextFactory = contextFactory?? DefaultContextFactory;
       this.OutputEncoding = outputEncoding?? DefaultEncoding;
 }
        protected virtual void PerformDefaultSetup()
        {
            var fac = new ZptDocumentFactory();
              _documentFactory = fac;
              _templateFactory = fac;

              _settingsFactory = new RenderingSettingsFactory();
        }