public override string GetRawDataString(object model)
        {
            string renderedView = string.Empty;
            var    view         = model as View;

            if (view != null)
            {
                string      extensionName = System.IO.Path.GetExtension(view.Path);
                IViewEngine viewEngine    = ViewEngineFactory.GetViewEngine(extensionName);
                try
                {
                    renderedView = viewEngine.RenderView(_context, view.Path, view.Model, view.ViewBag);
                }
                catch (Exception ex)
                {
                    throw ex;
                }
                return(renderedView);
            }
            else
            {
                _context.Response.Status = Status.Is.NotFound;
                return(model != null?model.ToString() : "");
            }
        }
Пример #2
0
 private static Response SafeInvokeViewEngine(IViewEngine viewEngine, ViewLocationResult locationResult, dynamic model, IRenderContext renderContext)
 {
     try
     {
         return(viewEngine.RenderView(locationResult, model, renderContext));
     }
     catch (Exception)
     {
         return(EmptyView);
     }
 }
Пример #3
0
 private static Action <Stream> SafeInvokeViewEngine(IViewEngine viewEngine, ViewLocationResult locationResult, dynamic model)
 {
     try
     {
         return(viewEngine.RenderView(locationResult, model));
     }
     catch (Exception)
     {
         return(NullView);
     }
 }
Пример #4
0
 private static Action <Stream> InvokeViewEngine(IViewEngine viewEngine, ViewLocation viewLocation, dynamic model)
 {
     try
     {
         return(viewEngine.RenderView(viewLocation, model));
     }
     catch (Exception)
     {
         return(stream => { });
     }
 }
Пример #5
0
 private static Action<Stream> SafeInvokeViewEngine(IViewEngine viewEngine, ViewLocationResult locationResult, dynamic model)
 {
     try
     {
         return viewEngine.RenderView(locationResult, model);
     }
     catch (Exception)
     {
         return EmptyView;
     }
 }
Пример #6
0
 private static Response SafeInvokeViewEngine(IViewEngine viewEngine, ViewLocationResult locationResult, dynamic model, IRenderContext renderContext)
 {
     try
     {
         return viewEngine.RenderView(locationResult, model, renderContext);
     }
     catch (Exception)
     {
         return EmptyView;
     }
 }
        protected override void InternalFillResponse(HttpResponseBase response, HttpContextBase context)
        {
            var viewData = GetViewData();

            _viewEngine.RenderView(viewData.ViewName, viewData.Data, response.OutputStream);
        }