我自己的带有 NServiceBus 的 Autofac 容器?
我正在尝试让 NServiceBus 与我已在应用程序中使用的容器一起使用。
当我看到 .AutofacBuilder
将采用预先存在的容器或范围时,我很兴奋。但是,我还想向我的容器注册总线,以便应用程序中的其他组件可以获取对 IBus 的引用。
这让我陷入了第二十二条军规。我需要对创建的总线的引用才能向我的容器注册。但是,创建总线需要引用已创建的容器。
我该如何解决这个问题?
I'm trying to get NServiceBus working with the container I already use in my application.
I got excited when I saw that .AutofacBuilder
will take a preexisting container or scope. However, I also want to register the bus with my container, so that other components in my application can get references to IBus
.
This leaves me in catch-22. I need a reference to the created bus to register with my container. However, creating the bus requires a reference to the created container.
How do I resolve this issue?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
NServiceBus 将在容器本身中注册 IBus 实例 - 您不需要这样做。
NServiceBus will register the instance of IBus in the container itself - you don't need to do it.