예제 #1
0
 public static void AddNodeServices(this IServiceCollection serviceCollection, NodeServicesOptions options) {
     serviceCollection.AddSingleton(typeof(INodeServices), (serviceProvider) => {
         var appEnv = serviceProvider.GetRequiredService<IApplicationEnvironment>();
         if (string.IsNullOrEmpty(options.ProjectPath)) {
             options.ProjectPath = appEnv.ApplicationBasePath;
         }
         return CreateNodeServices(options);
     });
 }
예제 #2
0
 public static INodeServices CreateNodeServices(NodeServicesOptions options)
 {
     var watchFileExtensions = options.WatchFileExtensions ?? defaultWatchFileExtensions;
     switch (options.HostingModel)
     {
         case NodeHostingModel.Http:
             return new HttpNodeInstance(options.ProjectPath, /* port */ 0, watchFileExtensions);
         case NodeHostingModel.InputOutputStream:
             return new InputOutputStreamNodeInstance(options.ProjectPath);
         default:
             throw new System.ArgumentException("Unknown hosting model: " + options.HostingModel.ToString());
     }
 }
예제 #3
0
        public static INodeServices CreateNodeServices(NodeServicesOptions options)
        {
            var watchFileExtensions = options.WatchFileExtensions ?? defaultWatchFileExtensions;

            switch (options.HostingModel)
            {
            case NodeHostingModel.Http:
                return(new HttpNodeInstance(options.ProjectPath, /* port */ 0, watchFileExtensions));

            case NodeHostingModel.InputOutputStream:
                return(new InputOutputStreamNodeInstance(options.ProjectPath));

            default:
                throw new System.ArgumentException("Unknown hosting model: " + options.HostingModel.ToString());
            }
        }
예제 #4
0
 public static void AddNodeServices(this IServiceCollection serviceCollection, NodeServicesOptions options)
 {
     serviceCollection.AddSingleton(typeof(INodeServices), (serviceProvider) => {
         var appEnv = serviceProvider.GetRequiredService <IApplicationEnvironment>();
         if (string.IsNullOrEmpty(options.ProjectPath))
         {
             options.ProjectPath = appEnv.ApplicationBasePath;
         }
         return(CreateNodeServices(options));
     });
 }