问题描述
我是新来的MVC所以请多多包涵。我试图找出谁调用Viewstart.cshtml,什么是涉及有步骤的顺序?路由表被访问之后或者叫才?
I am new to MVC so please bear with me. I am trying to find out who calls Viewstart.cshtml and what is the sequence of steps involved there? is it called after the route table is accessed or before it?
推荐答案
该RazorViewEngine有一个内部的只读域ViewStartFileName,它规定了起始视图的名称。 _ViewStart.cshtml(或.vbhtml)被称为每一个RazorView实例呈现时间(正在执行的RenderView()方法特别时)。
因此,谁将与它对应的RazorView类(包括其基类)的RazorViewEngine。要获得关于MVC请求管道一个相当不错的概述,我建议这个pdf.
The RazorViewEngine has an internal readonly field "ViewStartFileName" which specifies the name of the start view. _ViewStart.cshtml (or .vbhtml) is called each time a RazorView instance is rendered (specifically when the RenderView() method is being executed).So the "who" would be the RazorViewEngine with its corresponding RazorView class (including their base classes). To get a quite good overview on the MVC request pipeline I recommend this pdf.
这篇关于asp.net mvc的4 - 谁叫_ViewStart.cshtml,什么是步骤的顺序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!