Beispiel #1
0
        private ViewEngineResult Process(ViewEngineResult viewEngineResult, bool isPartial, string viewName,
            string masterName, bool useCache)
        {
            var contextStore = HttpContext.Current.Items;//Can this be removed?
            var vmStore = contextStore[GlimpseConstants.ViewEngine] as IList<GlimpseViewEngineCallMetadata>;

            if (vmStore == null)
                contextStore[GlimpseConstants.ViewEngine] = vmStore = new List<GlimpseViewEngineCallMetadata>();

            GlimpseView glimpseView = null;

            if (viewEngineResult.View != null)
            {
                //wrap up IView so we can get access to ViewContext
                glimpseView = new GlimpseView(viewEngineResult.View);
                glimpseView.ViewName = viewName;
                viewEngineResult = new ViewEngineResult(glimpseView, viewEngineResult.ViewEngine);
            }

            var metadata = new GlimpseViewEngineCallMetadata
                               {
                                   ViewEngineResult = viewEngineResult,
                                   IsPartial = isPartial,
                                   ViewName = viewName,
                                   MasterName = masterName,
                                   UseCache = useCache,
                                   GlimpseView = glimpseView,
                                   ViewEngineName = ViewEngine.GetType().Name
                               };
            vmStore.Add(metadata);

            return viewEngineResult;
        }
Beispiel #2
0
        private ViewEngineResult Process(ViewEngineResult viewEngineResult, bool isPartial, string viewName,
                                         string masterName, bool useCache)
        {
            var contextStore = HttpContext.Current.Items;//Can this be removed?
            var vmStore      = contextStore[GlimpseConstants.ViewEngine] as IList <GlimpseViewEngineCallMetadata>;

            if (vmStore == null)
            {
                contextStore[GlimpseConstants.ViewEngine] = vmStore = new List <GlimpseViewEngineCallMetadata>();
            }

            GlimpseView glimpseView = null;

            if (viewEngineResult.View != null)
            {
                //wrap up IView so we can get access to ViewContext
                glimpseView          = new GlimpseView(viewEngineResult.View);
                glimpseView.ViewName = viewName;
                viewEngineResult     = new ViewEngineResult(glimpseView, viewEngineResult.ViewEngine);
            }

            var metadata = new GlimpseViewEngineCallMetadata
            {
                ViewEngineResult = viewEngineResult,
                IsPartial        = isPartial,
                ViewName         = viewName,
                MasterName       = masterName,
                UseCache         = useCache,
                GlimpseView      = glimpseView,
                ViewEngineName   = ViewEngine.GetType().Name
            };

            vmStore.Add(metadata);

            return(viewEngineResult);
        }