我需要创建一些的 Windows服务应用程序(C#)应执行多个定期执行,并绑定到对方的任务,如:
所以,我游荡,如果我可以只用的快速和肮脏的的方针,实现这一切使用的BackgroundWorker 类,或者有使用更多复杂的东西,如任务ÿ等( .NET Windows服务 - 建筑的决定)。或事件有一些框架,做到这一点。
有关应用程序的可能的现代和干净结构任何意见将是很好听的。非常感谢你!
解决方案听起来你会需要这样的专用服务器上。所以我的第一个建议是使用 TopShelf 。它使得现代的Windows服务放在一起那么容易了可笑的。
然后执行你的问题我会使用某种形式的工作流模式的步骤。 的Windows Workflow Foundation 似乎是不够的现代化,以应付这一点。 (就个人而言,我只是用链方面的责任,该模式与DI容器作为我的快速和脏的)。
最后结合与该揭开序幕的工作流程,如 FileSystemWatcher的 ,你甚至不会需要担心backgroundworkers等。
因此,这些架构做出的决定,你的服务将是易于安装,运行,测试和安装(TopShelf),您可以构建和单元模块化测试服务(工作流模式)。
I need to create some Windows Service App (C#) that should perform several periodically executed and binded to each other tasks like:
So I am wandering if I can just use "quickly and dirty" approach and implement all this using BackgroundWorker class or I have use more sophisticated stuff like Tasks y etc (.NET Windows Service - Architectural Decisions). Or event there are some frameworks to do it.
Any advice about possible modern and clean structure of that application would be nice to hear. Thank you very much!
解决方案Sounds like you'll be needing this on a dedicated server. So my first suggestion is to use TopShelf. It makes putting together modern Windows services so easy its laughable.
Then to perform the steps in your question I'd use some sort of workflow pattern. Windows Workflow Foundation seems to be modern enough to cater for this. (Personally, I just use the chain-of-responsibility pattern with a DI container as my quick and "dirty").
Lastly combining that with an event-driven approach that kicks off the workflow, like FileSystemWatcher, you won't even need to worry about backgroundworkers etc.
So with those architecture decisions made, your service will be easy to setup, run, test and install (TopShelf), and you can build and unit test your service modularly (workflow pattern).
更多推荐
Windows服务应用程序体系结构的疑虑
发布评论