This might be easy question, but why mvc framework create separate controller class object for each request?
I know we can change this behavior using custom controller factory, refer any of below articles (lots of other articles are available).
custom-controller-factory or custom-controller-factory-1
So my question is, if we can preserve controller object for next or subsequent request. like below code.
//dicControllers : collection of controllers
if(dicControllers.ContainsKey("ctrl_name")) {
return dicControllers["ctrl_name"];
}
else
{
//create controller object
dicControllers["ctrl_name"] = ctrlObj;
}
....
THEN
Why framework does not provide this functionality. Is there any certain reason?
Will it improve the application performance (Please consider object creation time)?
Is there any problem, if i will do like this?