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自动注入它。
任何信息非常感谢。
谢谢
只是好奇 - 为什么你需要注入上下文?你是在嘲笑它进行测试吗? –