0

Based on https://cangencer.wordpress.com/2012/12/22/integrating-asp-net-web-api-with-castle-windsor/, it mentioned ApiController lifestyle to be scoped.

However, based on Should controller lifestyle always be transient in Windsor configuration for ASP.NET MVC?, it mentioned Controller lifestyle to be transient.

If both are ApiController and Controller are serving http request, why must ApiController lifestyle be scoped instead of transient?

The question here is why both are serving http request but Controller is set to Transient but ApiController is set to Scoped.

superhuman1314
  • 242
  • 2
  • 11
  • 3
    Why would a controller ever need to be scoped? I can't think of a single scenario where that would make sense. It should be simply transient. – Andy Aug 26 '20 at 20:09
  • Since both controller and apicontroller are serving http request, then why must apicontroller be scoped? I am looking for explaination. – superhuman1314 Aug 27 '20 at 05:16
  • BTW, there is no (practical) downside of using scoped here - the scope _is_ the web request so, in practice, scoped and transient are going to act the same in a web environment. – mjwills Aug 27 '20 at 05:19

0 Answers0