开发者

view and action method name

开发者 https://www.devze.com 2022-12-29 19:01 出处:网络
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 nam

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

0

精彩评论

暂无评论...
验证码 换一张
取 消