private IHtmlString PerformInvoke(DisplayContext displayContext, MethodInfo methodInfo, object serviceInstance)
        {
            var output = new HtmlStringWriter();
            var arguments = methodInfo.GetParameters()
                .Select(parameter => BindParameter(displayContext, parameter, output));

            var returnValue = methodInfo.Invoke(serviceInstance, arguments.ToArray());
            if (methodInfo.ReturnType != typeof(void))
            {
                output.Write(CoerceHtmlString(returnValue));
            }
            return output;
        }
        /// <summary>
        /// 使用指定的控制器上下文来查找指定的视图。
        /// </summary>
        /// <returns>
        /// 页视图。
        /// </returns>
        /// <param name="controllerContext">控制器上下文。</param><param name="viewName">视图的名称。</param><param name="masterName">母版的名称。</param><param name="useCache">若指定视图引擎返回缓存的视图(如果存在缓存的视图),则为 true;否则为 false。</param>
        public ViewEngineResult FindView(ControllerContext controllerContext, string viewName, string masterName, bool useCache)
        {
            var viewResult = _themeAwareViewEngine.FindPartialView(controllerContext, viewName, useCache, true);

            if (viewResult.View == null)
            {
                return viewResult;
            }

            if (!ThemeFilter.IsApplied(controllerContext.RequestContext))
            {
                return viewResult;
            }

            var layoutView = new LayoutView((viewContext, writer, viewDataContainer) =>
            {
                Logger.Information("准备呈现布局视图");

                var childContentWriter = new HtmlStringWriter();

                var childContentViewContext = new ViewContext(
                    viewContext,
                    viewContext.View,
                    viewContext.ViewData,
                    viewContext.TempData,
                    childContentWriter);

                viewResult.View.Render(childContentViewContext, childContentWriter);
                _workContext.Layout.Metadata.ChildContent = childContentWriter;

                var display = _displayHelperFactory.CreateHelper(viewContext, viewDataContainer);
                IHtmlString result = display(_workContext.Layout);
                writer.Write(result.ToHtmlString());

                Logger.Information("完成布局视图的呈现");
            }, (context, view) => viewResult.ViewEngine.ReleaseView(context, viewResult.View));

            return new ViewEngineResult(layoutView, this);
        }