接口攔截和構造函數有什麼區別注入
asp.net
統一? 我缺乏與統一 我的老項目和unity.config工作,瞭解DI的一些類似這樣的,Microsoft Unity接口攔截和構造函數的區別注入
<register type="ICRIC2012TrialUserService" mapTo="CRIC2012TrialUserService">
<lifetime type="perthread"/>
<interceptor type="InterfaceInterceptor"/>
<policyInjection/>
</register>
但一些不具備
<interceptor type="InterfaceInterceptor"/>
但在這些項目以同樣的方法類和接口的工作,這樣
private readonly IIncomingEstimateService _incomingEstimateService;
public ContractService(IIncomingEstimateService incomingEstimateService)
{
_incomingEstimateService = incomingEstimateService;
}
謝謝,這很有幫助。 – Bubble 2012-07-19 03:22:28