Should the controller lifestyle be temporary in the Windsor configuration for ASP.NET MVC?

I had a problem when I had an Html.DropDownList, in my opinion, that would return the selected value the first time the form was submitted, but each subsequent postback would only send data from the original postback. Therefore, I added a lifestyle = "transitional" to the component of the component in which I configured my controller for the lock windsor, which fixed the problem, but, of course, the postbacks made took more time from the moment of creating a new controller for each request. Given the information above, what ideas, suggestions, or solutions can help determine my initial question about management style? Thanks for the help and support!

+5
source share
3 answers

MVC controllers are temporary. Thinking about it, this makes sense for several reasons. Firstly, if one instance is used to serve several requests, and if several requests fall simultaneously on the same controller, you will encounter some rather strange race conditions. Secondly, HTTP is inherently stateless, and requests exist independently of each other. This is reflected in the transitional lifestyle of the controllers.

+6
source

, , , PerWebRequest Transient? , PerWebRequest, , . ?

+5

. , . , PerWebRequest .

, MVC WebApi, Windsor , .

PerWebRequest, , .

+4

All Articles