/// <summary>
 /// Initializes a new instance of the <see cref="NodeRenderEngine" /> class.
 /// </summary>
 /// <param name="options">The options.</param>
 public NodeRenderEngine(NodeRenderEngineOptions options)
 {
     _options      = options;
     _nodeServices = Configuration.CreateNodeServices(new NodeServicesOptions
     {
         HostingModel        = options.NodeHostingModel,
         ProjectPath         = options.ProjectDirectory,
         WatchFileExtensions = options.WatchFileExtensions
     });
 }
        public NodeRenderEngineBuilder(
            Microsoft.AspNetCore.Hosting.IWebHostEnvironment hostingEnvironment,
            IServiceProvider serviceProvider,
            IOptions <NodeRenderEngineOptions> options)
        {
            _serviceProvider = serviceProvider;
            _options         = options.Value;

            if (string.IsNullOrEmpty(_options.ProjectDirectory))
            {
                _options.ProjectDirectory = hostingEnvironment.WebRootPath;
            }
        }
Esempio n. 3
0
 public NodeRenderEngineBuilder(
     #if DOTNETCORE
     Microsoft.AspNetCore.Hosting.IHostingEnvironment hostingEnvironment,
     #endif
     IOptions <NodeRenderEngineOptions> options)
 {
     _options = options.Value;
     if (string.IsNullOrEmpty(_options.ProjectDirectory))
     {
         #if DOTNETCORE
         _options.ProjectDirectory = hostingEnvironment.WebRootPath;
         #else
         _options.ProjectDirectory = System.Web.Hosting.HostingEnvironment.MapPath("~/App_Data");
         #endif
     }
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="NodeRenderEngine" /> class.
        /// </summary>
        /// <param name="serviceProvider">The service provider.</param>
        /// <param name="options">The options.</param>
        public NodeRenderEngine(IServiceProvider serviceProvider, NodeRenderEngineOptions options)
        {
            _options = options;

            var nodeOptions = new NodeServicesOptions(serviceProvider)
            {
                HostingModel        = options.NodeHostingModel,
                ProjectPath         = options.ProjectDirectory,
                WatchFileExtensions = options.WatchFileExtensions
            };

            if (options.NodeInstanceOutputLogger != null)
            {
                nodeOptions.NodeInstanceOutputLogger = options.NodeInstanceOutputLogger;
            }

            _nodeServices = NodeServicesFactory.CreateNodeServices(nodeOptions);
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="NodeRenderEngine" /> class.
        /// </summary>
        /// <param name="serviceProvider">The service provider.</param>
        /// <param name="options">The options.</param>
        public NodeRenderEngine(IServiceProvider serviceProvider, NodeRenderEngineOptions options)
        {
            _options = options;

            var nodeOptions = new NodeServicesOptions(serviceProvider ?? new EmptyServiceProvider())
            {
                ProjectPath          = options.ProjectDirectory,
                WatchFileExtensions  = options.WatchFileExtensions,
                EnvironmentVariables = options.EnvironmentVariables,
                DebuggingPort        = options.DebuggingPort,
                LaunchWithDebugging  = options.LaunchWithDebugging
            };

            if (options.NodeInstanceFactory != null)
            {
                nodeOptions.NodeInstanceFactory = options.NodeInstanceFactory;
            }
            if (options.NodeInstanceOutputLogger != null)
            {
                nodeOptions.NodeInstanceOutputLogger = options.NodeInstanceOutputLogger;
            }

            _nodeServices = NodeServicesFactory.CreateNodeServices(nodeOptions);
        }