where does m开发者_Python百科vc stores the association between action method name and view page name? or who is responsible for checking if the there is a view page with name same as action method name?
You are the one who specifies the relation between the view and the action. By default, when you return View();
, ASP.NET MVC assumes that the view name is the same as the action name. You can, however, return View("About");
which will render the view page About.
There is no static checking -- the framework searches for the view at runtime. Therefore, the association is not stored anywhere.
The ViewEngine takes care of all that for you.
Have a gander at this post about creating your own view engine... it gives you an idea of what's going on behind the scenes.
HTHs,
Charles
精彩评论