我自己的带有 NServiceBus 的 Autofac 容器?

发布于 2024-12-21 11:49:29 字数 234 浏览 4 评论 0原文

我正在尝试让 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

安人多梦 2024-12-28 11:49:29

NServiceBus 将在容器本身中注册 IBus 实例 - 您不需要这样做。

NServiceBus will register the instance of IBus in the container itself - you don't need to do it.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文