使用带WCF Web服务的Ninject WCF扩展 [英] Using Ninject WCF Extension with WCF Web Service
问题描述
有没有人有任何成功使用Ninject与WCF,谷歌似乎返回一点相关的结果为我正在寻找的主题
TimeService 具有:
<%@ ServiceHost Language =C#Debug =trueService =WcfTimeService.TimeServiceCodeBehind =TimeService.svc.cs** Factory =Ninject.Extensions.Wcf.NinjectServiceHostFactory**% >
混蛋注入 ctors混淆事情 - Ninject将选择最具体的构造函数。该示例的一般问题是它涵盖了所有的基础(IIS Hosted,EXE托管,服务托管),WCF并不完全使所有这些东西容易管理(@Ian Davis:我可以很容易地错了,你能提供请稍后再来一些细节,或者以README中的样本说明为例,以及您为何使用BI的各种情况的更多细节?)
I have a WCF web service in which I want to use my Repositories and Services which I wish to dependency inject into my WCF web service, however the Ninject WCF Extension example pretty much has a ctor which is instantiating an instance of each dependency, which I don't want, I wanted a purer dependency injection.
Has anyone had any success with using Ninject with WCF, Google seems to return little relevant results for the topics I am looking for.
The code behind for TimeService has:
<%@ ServiceHost Language="C#" Debug="true" Service="WcfTimeService.TimeService" CodeBehind="TimeService.svc.cs" **Factory="Ninject.Extensions.Wcf.NinjectServiceHostFactory"** %>
The bastard injection ctors confuse the matter - Ninject will choose the most specific constructor. The general problem with the sample is that it's covering all the bases (IIS Hosted, EXE hosted, Service Hosted), and WCF doesnt exactly make all this stuff easy to manage either (@Ian Davis: I could easily be wrong, can you provide some more detail please , perhaps in the form of a summary of what the samples illustrate in the README, and perhaps more detail in the why of the various cases where you've used BI?)
这篇关于使用带WCF Web服务的Ninject WCF扩展的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!