Beispiel #1
0
        public static bool TryGetPage(this ScriptScopeContext scope, string virtualPath, out SharpPage page, out SharpCodePage codePage)
        {
            if (scope.PageResult.Partials.TryGetValue(virtualPath, out page))
            {
                codePage = null;
                return(true);
            }

            if (!scope.Context.TryGetPage(scope.PageResult.VirtualPath, virtualPath, out page, out codePage))
            {
                return(false);
            }

            codePage?.Init();

            if (codePage is IRequiresRequest requiresRequest)
            {
                if (scope.GetValue(ScriptConstants.Request) is IRequest request)
                {
                    requiresRequest.Request = request;
                }
            }

            return(true);
        }