EventBus:C#事件总线实现

上传者: 42172972 | 上传时间: 2022-11-28 19:08:30 | 文件大小: 33KB | 文件类型: ZIP
1.简单介绍 事件总线这个概念对您来说可能很陌生,但提到观察者(发布-订阅)模式,你也许就很熟悉。事件总线是对发布-订阅模式的一种实现。它是一种集中式事件处理机制,允许不同的组件之间进行彼此通信而又不需要相互依赖,达到一种解分解的目的。 我们来看看事件总线的处理流程: 事件总线就相当于一个介于发布者和订阅者中间的主轴。它隔离了出版物和订阅者之间的直接依赖,接管了所有事件的发布和订阅逻辑,并负责事件的中转。 2.实现原理 3.事件总线的实现要点 事件总线维护一个事件源与事件处理的映射字典; 通过单例模式,确保事件总线的唯一入口; 利用反射或依赖注入完成事件源与事件处理的初始化绑定; 提供统一的

文件下载

资源详情

[{"title":"( 41 个子文件 33KB ) EventBus:C#事件总线实现","children":[{"title":"EventBus-master","children":[{"title":".gitignore <span style='color:#111;'> 3.70KB </span>","children":null,"spread":false},{"title":"EventBus.sln <span style='color:#111;'> 1.90KB </span>","children":null,"spread":false},{"title":"LICENSE <span style='color:#111;'> 1.04KB </span>","children":null,"spread":false},{"title":"_config.yml <span style='color:#111;'> 26B </span>","children":null,"spread":false},{"title":"README.md <span style='color:#111;'> 1.24KB </span>","children":null,"spread":false},{"title":"EventBus.Test","children":[{"title":"TestEventData.cs <span style='color:#111;'> 337B </span>","children":null,"spread":false},{"title":"EventBus.Test.csproj <span style='color:#111;'> 6.52KB </span>","children":null,"spread":false},{"title":"packages.config <span style='color:#111;'> 874B </span>","children":null,"spread":false},{"title":"EventBut_Simple_Test.cs <span style='color:#111;'> 3.90KB </span>","children":null,"spread":false},{"title":"RabbitMQEventBus_Test.cs <span style='color:#111;'> 4.47KB </span>","children":null,"spread":false},{"title":"InMemory_EventStore_Test.cs <span style='color:#111;'> 1.39KB </span>","children":null,"spread":false},{"title":"EventBusTestBase.cs <span style='color:#111;'> 466B </span>","children":null,"spread":false},{"title":"TestEventHandler.cs <span style='color:#111;'> 422B </span>","children":null,"spread":false},{"title":"Properties","children":[{"title":"AssemblyInfo.cs <span style='color:#111;'> 645B </span>","children":null,"spread":false}],"spread":false}],"spread":true},{"title":"EventBus","children":[{"title":"IEventBus.cs <span style='color:#111;'> 1.05KB </span>","children":null,"spread":false},{"title":"packages.config <span style='color:#111;'> 789B </span>","children":null,"spread":false},{"title":"EventStore","children":[{"title":"InMemoryEventStore.cs <span style='color:#111;'> 3.88KB </span>","children":null,"spread":false},{"title":"IEventStore.cs <span style='color:#111;'> 943B </span>","children":null,"spread":false}],"spread":true},{"title":"EventData.cs <span style='color:#111;'> 633B </span>","children":null,"spread":false},{"title":"IEventData.cs <span style='color:#111;'> 537B </span>","children":null,"spread":false},{"title":"log4net.config <span style='color:#111;'> 583B </span>","children":null,"spread":false},{"title":"EventBus.csproj <span style='color:#111;'> 4.69KB </span>","children":null,"spread":false},{"title":"RabbitMQ","children":[{"title":"RabbitMQEventBus.cs <span style='color:#111;'> 8.54KB </span>","children":null,"spread":false}],"spread":false},{"title":"EventBusWithReflection.cs <span style='color:#111;'> 4.60KB </span>","children":null,"spread":false},{"title":"EventBus.cs <span style='color:#111;'> 8.47KB </span>","children":null,"spread":false},{"title":"Handlers","children":[{"title":"IEventHandler.cs <span style='color:#111;'> 748B </span>","children":null,"spread":false},{"title":"ActionEventHandler.cs <span style='color:#111;'> 943B </span>","children":null,"spread":false}],"spread":false},{"title":"Properties","children":[{"title":"AssemblyInfo.cs <span style='color:#111;'> 1.26KB </span>","children":null,"spread":false}],"spread":false},{"title":"LoggerInstaller.cs <span style='color:#111;'> 606B </span>","children":null,"spread":false}],"spread":false},{"title":".gitattributes <span style='color:#111;'> 2.46KB </span>","children":null,"spread":false},{"title":"EventBus.Demo","children":[{"title":"Program.cs <span style='color:#111;'> 2.06KB </span>","children":null,"spread":false},{"title":"FishType.cs <span style='color:#111;'> 246B </span>","children":null,"spread":false},{"title":"FishingEventData.cs <span style='color:#111;'> 304B </span>","children":null,"spread":false},{"title":"IFishingRod.cs <span style='color:#111;'> 115B </span>","children":null,"spread":false},{"title":"FishingRod.cs <span style='color:#111;'> 929B </span>","children":null,"spread":false},{"title":"App.config <span style='color:#111;'> 184B </span>","children":null,"spread":false},{"title":"EventBus.Demo.csproj <span style='color:#111;'> 2.73KB </span>","children":null,"spread":false},{"title":"FishingRodWithDelegate.cs <span style='color:#111;'> 2.29KB </span>","children":null,"spread":false},{"title":"FishingEventHandler.cs <span style='color:#111;'> 941B </span>","children":null,"spread":false},{"title":"FishingMan.cs <span style='color:#111;'> 591B </span>","children":null,"spread":false},{"title":"Properties","children":[{"title":"AssemblyInfo.cs <span style='color:#111;'> 1.28KB </span>","children":null,"spread":false}],"spread":false}],"spread":false}],"spread":true}],"spread":true}]

评论信息

免责申明

【只为小站】的资源来自网友分享,仅供学习研究,请务必在下载后24小时内给予删除,不得用于其他任何用途,否则后果自负。基于互联网的特殊性,【只为小站】 无法对用户传输的作品、信息、内容的权属或合法性、合规性、真实性、科学性、完整权、有效性等进行实质审查;无论 【只为小站】 经营者是否已进行审查,用户均应自行承担因其传输的作品、信息、内容而可能或已经产生的侵权或权属纠纷等法律责任。
本站所有资源不代表本站的观点或立场,基于网友分享,根据中国法律《信息网络传播权保护条例》第二十二条之规定,若资源存在侵权或相关问题请联系本站客服人员,zhiweidada#qq.com,请把#换成@,本站将给予最大的支持与配合,做到及时反馈和处理。关于更多版权及免责申明参见 版权及免责申明