Castle.Windsor and HttpContextWrapper

前端 未结 3 614
一整个雨季
一整个雨季 2021-01-16 02:16

HttpContextWrapper and HttpContextBase, as explained here, were introduced to make HttpContext more mockable/testable.

I\'m trying to use it with S#arp Architecture,

3条回答
  •  滥情空心
    2021-01-16 02:32

    As Darin noted, it makes no sense to inject an HttpContext into an MVC controller. However, if you need it for other kind of services and also need it in Application_Start(), use an hybrid perwebrequest-transient lifestyle. Or, since it's trivial to build, just make it transient.

提交回复
热议问题