GetPageType() public static method

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
return System.Type
Exemplo n.º 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);
        }
Exemplo n.º 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);
            }
        }