namespace Dipper.Alioth.Extensions; public static class StartHostExtension { /// /// 添加监听服务文件夹组件 /// /// /// public static WebStarHost AddWatchServiceFolder(this WebStarHost host, string path) { if (!Directory.Exists(path)) { throw new DirectoryNotFoundException(path); } // 这块地方应当是另一个类的 // 且该类应当依赖注入(单例注入)至Host主机中 var watcher = new FileSystemWatcher(path); watcher.EnableRaisingEvents = true; return host; } }