WCF PerCall 实例服务器和使用 Prism 的依赖注入?

发布于 2024-07-30 13:49:24 字数 212 浏览 1 评论 0原文

如果我有使用 Prism 和 WCF 构建的客户端/服务器类型的应用程序,并且我希望在服务器端每次调用都启动 wcf 服务,但我想使用依赖项注入(使用 Prism 中的 UnityContainer)。 我怎么可能这么做呢? 我应该有一个单实例服务,这不会有问题,但是 WCF 中是否有任何钩子允许在应该实例化服务并返回该实例时调用委托?

有任何想法吗?

干杯!

If I have a client/server type of application built using both Prism and WCF, and I would like on the serverside to have the wcf service to be instatiated per call BUT I would like to use dependency injection (using the UnityContainer in Prism). How could I possibly do this? Should I have a single instance service it would be no problem, but are there any hooks in WCF to allow for a delegate to be called whenever a service is supposed to be instantiated and have this instance returned?

Any ideas?

Cheers!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(1

十级心震 2024-08-06 13:49:24

有可能的! WCF 为 WCF 责任链提供了一个名为 IInstanceProvider 的插件。 这允许您用自己的结构替换该结构。

有人已将其实现为服务行为,可在此处获取:
http://code.msdn.microsoft.com/WCFResources/发布/ProjectReleases.aspx?ReleaseId=1252

It is possible! WCF provides a plugin to the WCF responsibility chain called an IInstanceProvider. This allows for you to replace the construction with your own.

Someone has implemented this as a service behavior and is available here:
http://code.msdn.microsoft.com/WCFResources/Release/ProjectReleases.aspx?ReleaseId=1252

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