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); }); }
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()); } }
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()); } }
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)); }); }