PreSendView() public method

Invoked by the view engine to perform any logic before the view is sent to the client.
public PreSendView ( object view ) : void
view object
return void
Esempio n. 1
0
		/// <summary>
		/// Invokes the <see cref="Controller.PreSendView"/>
		/// </summary>
		/// <param name="controller">The controller.</param>
		/// <param name="view">The view argument.</param>
		protected virtual void PreSendView(Controller controller, object view)
		{
			controller.PreSendView(view);
		}
Esempio n. 2
0
		public override void Process(TextWriter output, IRailsEngineContext context, Controller controller, string templateName)
		{
			string fileName = GetFileName(templateName);
			AspViewBase view = null;
			TextWriter viewOutput = output;
			AspViewBase layout = null;
			if (controller.LayoutName != null)
			{
				layout = GetLayout(output, context, controller);
				viewOutput = layout.ViewOutput;
			}
			view = GetView(fileName, viewOutput, context, controller);
			if (view == null)
				throw new RailsException(string.Format(
					"Cannot find view '{0}'", fileName));
			controller.PreSendView(view);
			view.Render();
			if (layout != null)
			{
				layout.SetParent(view);
				layout.Render();
			}
			controller.PostSendView(view);
		}
Esempio n. 3
0
		public override void Process(TextWriter output, IRailsEngineContext context, Controller controller,
									 string templateName)
		{
			Log("Starting to process request for {0}", templateName);
			string file = templateName.ToUpper() + ViewFileExtension;
			BrailBase view;
			// Output may be the layout's child output if a layout exists
			// or the context.Response.Output if the layout is null
			LayoutViewOutput layoutViewOutput = GetOutput(output, context, controller);
			// Will compile on first time, then save the assembly on the cache.
			view = GetCompiledScriptInstance(file, layoutViewOutput.Output, context, controller);
			controller.PreSendView(view);
			Log("Executing view {0}", templateName);
			view.Run();
			if (layoutViewOutput.Layout != null)
			{
				layoutViewOutput.Layout.SetParent(view);
				layoutViewOutput.Layout.Run();
			}
			Log("Finished executing view {0}", templateName);
			controller.PostSendView(view);
		}