Home > Net >  When will the.net MVC controller was destroyed
When will the.net MVC controller was destroyed

Time:11-22

RT: each controller to handle a user session, or a controller to handle all sessions, under what circumstances will be destroyed

CodePudding user response:

Don't know said what mean

CodePudding user response:

After return the result should be destroyed

CodePudding user response:

Think about yourself, write a test not to know?

CodePudding user response:

For every user in will be instantiated. A controller is accurate, the context object will examples, including controller, a series of objects. When I started school, in order to avoid new dbContext for many times, it is written in the controller of a static field, found behind is actually each user are not the same.

CodePudding user response:

# 4 said the context object is the key, each access, is a new context object, httpcontext

CodePudding user response:

Hjkl950217
reference 4 floor response:
for every user in will be instantiated. A controller is accurate, the context object will examples, including controller, a series of objects. When I started school, in order to avoid new dbContext for many times, it is written in the controller of a static field, found behind is actually each user's different.


All static, will be different?

CodePudding user response:

I only know general handler IHttpHandler these Reusable attribute, the Controller class also don't know, for a long time without the MVC

CodePudding user response:

Hjkl950217
reference 4 floor response:
for every user in will be instantiated. A controller is accurate, the context object will examples, including controller, a series of objects. When I started school, in order to avoid new dbContext for many times, it is written in the controller of a static field, found behind is actually each user's different.


What is different? If just different threads cached data is different, how can you determine the host dbContext different?

CodePudding user response:

Post your test code, the code is not cheating, it is to rely on vague to disorderly guess often lie to yourself,

CodePudding user response:

Unresolved, their top three years later

CodePudding user response:

references to the tenth floor Mr Brain response:
unresolved, three years later his top

Ha, ha, ha, 666,
If I remember correctly, the controller is the default singleton,
  • Related