We don’t allow questions seeking recommendations for software libraries, tutorials, tools, books, or other off-site resources. You can edit the question so it can be answered with facts and citations.
Closed 8 years ago.
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(8)
Tiny Messenger 是一个不错的选择,我已经在现场项目中使用它 2.5 年了。 来自 Wiki 的一些代码示例(链接如下):
发布
订阅
代码位于 GitHub 上:https://github.com/grumpydev/TinyMessenger
Wiki 位于: https://github.com/grumpydev/TinyMessenger/wiki
它还有一个 Nuget 包
Tiny Messenger is a good choice, I've been using it in a live project for 2.5 years now. Some code examples from the Wiki (link below):
Publishing
Subscribing
The code's on GitHub: https://github.com/grumpydev/TinyMessenger
The Wiki is here: https://github.com/grumpydev/TinyMessenger/wiki
It has a Nuget package also
另一种,受 Android 的 EventBus 启发,但简单得多:
用例:
Another one, inspired by EventBus for android, but far simpler:
Use case:
复合应用程序块包含一个事件代理,可能用于你。
The Composite Application Block includes an event broker that might be of use to you.
您还可以查看 Unity 扩展:
http://msdn.microsoft.com/en-us/library/cc440958。 aspx
有更好的吗?
You might also check out Unity extensions:
http://msdn.microsoft.com/en-us/library/cc440958.aspx
Are there better ones?
我发现通用消息总线 。 这是一堂简单的课。
I found Generic Message Bus . It is one simple class.
另一个好的实现可以在以下位置找到:
http: //code.google.com/p/fracture/source/browse/trunk/Squared/Util/EventBus.cs
用例可在以下位置访问:
/trunk/Squared/Util/UtilTests/Tests/EventTests.cs
此实现不需要外部库。
改进可能是能够使用类型而不是字符串进行订阅。
Another good implementation can be found at:
http://code.google.com/p/fracture/source/browse/trunk/Squared/Util/EventBus.cs
Use cases is accessible at:
/trunk/Squared/Util/UtilTests/Tests/EventTests.cs
This implementation does not need external library.
An improvement may be to be able to subscribe with a type and not a string.
您应该查看 Ayende 的截屏系列 Hibernating Rhinos 中的第 3 集 - “实施事件代理” ”。
它展示了如何使用 Windsor 来实现一个非常简单的事件代理来连接事物。 还包括源代码。
所提出的事件代理解决方案非常简单,但不需要花费太多时间来增强该解决方案以允许参数与事件一起传递。
You should check out episode 3 in Hibernating Rhinos, Ayende's screen casts series - "Implementing the event broker".
It shows how you can implement a very simple event broker using Windsor to wire things up. Source code is included as well.
The proposed event broker solution is very simple, but it would not take too many hours to augment the solution to allow arguments to be passed along with the events.
我创建了这个:
https://github.com/RemiBou/RemiDDD/tree /master/RemiDDD.Framework/Cqrs
与 ninject 存在依赖关系。
你有一个消息处理器。 如果你想观察一个事件,实现“IObserver”;如果你想处理命令,实现“ICommandHandleer”
I created this :
https://github.com/RemiBou/RemiDDD/tree/master/RemiDDD.Framework/Cqrs
There is a dependancy with ninject.
You got a MessageProcessor. If you want to obsere an event, implement "IObserver" if you want to handle a command implement "ICommandHandleer"