GetPageType() публичный статический Метод

Get the type of the viewpage class for a virtual path. Returns null if the view page does not exist
public static GetPageType ( string virtualPath ) : Type
virtualPath string
Результат System.Type
Пример #1
0
        private Type GetViewStartType()
        {
            var vp = this.VirtualPath;

            while (vp.Contains("/Views/"))
            {
                vp = vp.Substring(0, vp.LastIndexOf("/"));
                var vs = CompiledRazorViewEngine.GetPageType(vp + "/_ViewStart.cshtml");
                if (vs != null)
                {
                    return(vs);
                }
            }
            return(null);
        }
Пример #2
0
        private dynamic GetLayout()
        {
            if (string.IsNullOrEmpty(Layout))
            {
                return(null);
            }
            var t = CompiledRazorViewEngine.GetPageType(Layout);

            if (t != null)
            {
                return(t.GetConstructor(new Type[] { }).Invoke(new object[] { }));
            }
            else
            {
                return(null);
            }
        }