WCF PerCall 实例服务器和使用 Prism 的依赖注入?
如果我有使用 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
有可能的! 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