我的工作中有一个系统,它基本上是一个消息驱动的状态机.它接收各种类型的消息,根据消息查找一些上下文/状态,然后根据消息和当前状态决定要做什么.通常结果是一条消息被发送出系统.
We have a system at my work that is basically a message-driven state machine. It takes in a variety of types of messages, looks up some context/state based on the message, then decides what to do, based on the message and the current state. Normally the result is a message being sent out of the system.
是否有任何好的开源框架可以在 .NET 中实现状态机?我查看了最新版本的 Windows Workflow,它似乎是一个不错的选择;但是,我对默认的持久性机制(我们需要报告状态转换数据)、可测试性以及 WF 团队正在重新构建框架这一事实(据推测)存在一些担忧.
Are there any good open-source frameworks for implementing a state machine in .NET? I've looked into the latest release of Windows Workflow, and it seems like it would be a good option; however, I have some concerns about the default persistence mechanisms (we need to report off the state transition data), testability, and the fact that the WF team is re-architecting the framework as we speak (supposedly).
我正在考虑尝试实现一个普通的 GoF状态"模式,而不是 WF,并使用 Spring.NET 将所有内容连接在一起.有没有什么东西已经这样做了,或者类似的东西?
Instead of WF, I'm thinking of trying to implement a plain-old GoF "State" pattern, and using Spring.NET to wire everything together. Is there anything out there that already does this, or something similar?
根据您的具体要求,您可能会找到 状态机编译器 足以实现 GoF状态"模式.它可以生成 C# 以及可以使用 Graphviz 转换为多种图像格式的点.我在以前的项目中使用过它,发现它足以生成简单"状态机.我希望这有帮助.
Depending on your exact requirements you might find the State Machine Compiler is sufficient for implementing the GoF "State" pattern. It can generate C# as well as dot which can be transformed into several image formats using Graphviz. I've used it on a previous project and found it sufficient for generating a 'simple' state machine. I hope this helps.
这篇关于.NET 的状态机框架的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!