0
我一直在處理.net 4.0 webapi寧靜服務項目。在該項目中,我們希望動態注入WebOberationContext.Current。有沒有什麼辦法可以使用Autofac來達到這個目的。我GOOGLE了很多,但還沒有找到解決方案。就目前我使用下面的代碼:WCF寧靜服務注入WebOperationContext與Autofac
public class SomeObject : ISomeObject
{
private readonly ISomeService _someService;
public SomeObject(ISomeService someService)
{
_someService = someService;
}
public WebOperationContext Context { get; set; }
public void SomeOperation()
{
var incomeRequtests = Context.Current.IncomingRequests;
}
}
而不是設置WebOperationContext財產,我想了解,如果我們可以用autofac自動注入它。
任何信息非常感謝。
謝謝
只是好奇 - 爲什麼你需要注入上下文?你是在嘲笑它進行測試嗎? –