c# - Actions are stateless but are controllers stateless? -


i think of understanding of mvc fatally flawed. i've assumed action methods in controller stateless , controller stateless.

so, new instance of controller created every time action called?

a new instance of controller created every request coming in. consider this:

public class homecontroller : controller {     public actionresult index()     {         return moreindex();     }      public actionresult moreindex()     {         return view();     } } 

a request coming in /home/index enter 2 actions, 1 controller created. request coming in /home/moreindex enter 1 action , 1 controller created. nothing prevents manually creating controller , keeping alive , re-using it. never in context of actual request coming http.


Comments

Popular posts from this blog

How to mention the localhost in android -

php - Calling a template part from a post -

c# - String.format() DateTime With Arabic culture -