当前位置: 首页>>代码示例>>C#>>正文


C# IController.PreSendView方法代码示例

本文整理汇总了C#中IController.PreSendView方法的典型用法代码示例。如果您正苦于以下问题:C# IController.PreSendView方法的具体用法?C# IController.PreSendView怎么用?C# IController.PreSendView使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IController的用法示例。


在下文中一共展示了IController.PreSendView方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Process

		// Process a template name and output the results to the user
		// This may throw if an error occured and the user is not local (which would 
		// cause the yellow screen of death)
		public override void Process(String templateName, TextWriter output, IEngineContext context, IController controller,
									 IControllerContext controllerContext)
		{
			Log("Starting to process request for {0}", templateName);
			string file = templateName + 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, controllerContext);
			// Will compile on first time, then save the assembly on the cache.
			view = GetCompiledScriptInstance(file, layoutViewOutput.Output, context, controller, controllerContext);
			if (controller != null)
			{
				controller.PreSendView(view);
			}

			Log("Executing view {0}", templateName);

			RenderView(templateName, view);

			layoutViewOutput.RenderLayouts(this, view);

			Log("Finished executing view {0}", templateName);
			if (controller != null)
			{
				controller.PostSendView(view);
			}
		}
开发者ID:ralescano,项目名称:castle,代码行数:31,代码来源:BooViewEngine.cs

示例2: PreSendView

		/// <summary>
		/// Invokes the <see cref="IController.PreSendView"/>
		/// </summary>
		/// <param name="controller">The controller.</param>
		/// <param name="view">The view argument.</param>
		protected virtual void PreSendView(IController controller, object view)
		{
			controller.PreSendView(view);
		}
开发者ID:rambo-returns,项目名称:MonoRail,代码行数:9,代码来源:ViewEngineBase.cs

示例3: Process

		public override void Process(string templateName, TextWriter output, IEngineContext context, IController controller, IControllerContext controllerContext)
		{
			// Get the main, entry-point, view instance
			IViewBaseInternal view = GetView(templateName, output, context, controller, controllerContext);

			// create layout views if needed. The entry point is changed to the outer-most layout.
			// each layout on the way holds its containing layout on the ContentView property,
			// down to the original entry-point.
			if (controllerContext.LayoutNames != null)
			{
				var layoutNames = controllerContext.LayoutNames;
				for (var i = layoutNames.Length - 1; i >= 0; --i)
				{
					var layoutName = layoutNames[i].Trim();
					IViewBaseInternal layout = GetLayout(layoutName, output, context, controller, controllerContext);
					layout.ContentView = view;
					view = layout;
				}
			}
			if (controller != null)
			{
				controller.PreSendView(view);
			}

			// initialize the entry point
			view.Initialize(this,output, context, controller, controllerContext, null);

			// initialize inner layouts down to the original entry-point
			var parent = view;
			var backtraceLayoutsToMainView = view.ContentView;
			while (backtraceLayoutsToMainView!=null)
			{
				backtraceLayoutsToMainView.Initialize(this, output, context, controller, controllerContext, parent.Properties);
				parent = backtraceLayoutsToMainView;
				backtraceLayoutsToMainView = parent.ContentView;
			}
			InitializeViewsStack(context);
			// process the view
			view.Process();
			if (controller != null)
			{
				controller.PostSendView(view);
			}
		}
开发者ID:bluesliverx,项目名称:Castle.MonoRail,代码行数:44,代码来源:AspViewEngine.cs

示例4: ProcessPartial

		public override void ProcessPartial(string partialName, TextWriter output, IEngineContext context,
											IController controller, IControllerContext controllerContext)
		{
            if (!initialized) Initialize();
			Log("Generating partial for {0}", partialName);

			try
			{
				string file = ResolveTemplateName(partialName);
				BrailBase view = GetCompiledScriptInstance(file, output, context, controller, controllerContext, partialName);
                TextWriter oldos = null;
                string key = "";
                bool fromcache = false;

                if (controller != null)
                {
                    controller.PreSendView(view);
                }
                Stopwatch sw = null;
                if (options.CollectStatistics)
                {
                    sw = Stopwatch.StartNew();
                }

                if (view.__isCacheable())
                {
                    key = view.__getCacheKey();
                    if (_outputCache.ContainsKey(key))
                    {
                        view.OutputStream.Write(_outputCache[key]);
                        fromcache = true;
                    }
                    else
                    {
                        oldos = view.OutputStream;
                        view.SetOutputStream(new StringWriter());
                    }

                }

                if (!fromcache)
                {
                    _renderp(partialName, view);
                    if (view.__isCacheable())
                    {
                        var content = view.OutputStream.ToString();
                        _outputCache[key] = content;
                        view.SetOutputStream(oldos);
                        view.OutputStream.Write(content);
                    }
                }

                if (options.CollectStatistics)
                {
                    sw.Stop();
                    this.Statistics.Rendered(partialName, fromcache, sw.ElapsedTicks);
                }


                _renderp(partialName, view);
			}
			catch (Exception ex)
			{
				if (Logger != null && Logger.IsErrorEnabled)
				{
					Logger.Error("Could not generate JS", ex);
				}

				throw new MonoRailException("Error generating partial: " + partialName, ex);
			}
		}
开发者ID:Qorpent,项目名称:comdiv.oldcore,代码行数:71,代码来源:BooViewEngine.cs

示例5: Process

		// Process a template name and output the results to the user
		// This may throw if an error occured and the user is not local (which would 
		// cause the yellow screen of death)
		public override void Process(String templateName, TextWriter output, IEngineContext context, IController controller,
									 IControllerContext controllerContext)
		{
			Log("Starting to process request for {0}", templateName);
			string file = templateName + 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, controllerContext);
			// Will compile on first time, then save the assembly on the cache.

			view = GetCompiledScriptInstance(file, layoutViewOutput.Output, context, controller, controllerContext,templateName);


		    Stopwatch sw = null;
            if(options.CollectStatistics) {
                sw = Stopwatch.StartNew();
            }

		    TextWriter oldos = null;
		    string key = "";
		    bool fromcache = false;

            if (controller != null)
            {
                controller.PreSendView(view);
            }


            if(view.__isCacheable()){
                key = view.__getCacheKey();
                if (_outputCache.ContainsKey(key))
                {
                    view.OutputStream.Write(_outputCache[key]);
                    fromcache = true;
                }
                else
                {
                    oldos = view.OutputStream;
                    view.SetOutputStream(new StringWriter());
                }



            }

            if (!fromcache)
            {
                _render(templateName, layoutViewOutput, view);
                if (view.__isCacheable())
                {
                    var content = view.OutputStream.ToString();
                    _outputCache[key] = content;
                    view.SetOutputStream(oldos);
                    view.OutputStream.Write(content);
                }
            }
			
			
            if(options.CollectStatistics) {
                sw.Stop();
                this.Statistics.Rendered(templateName,fromcache,sw.ElapsedTicks);
            }


		    if (controller != null)
			{
				controller.PostSendView(view);
			}
		}
开发者ID:Qorpent,项目名称:comdiv.oldcore,代码行数:73,代码来源:BooViewEngine.cs

示例6: Process

		public override void Process(string templateName, TextWriter output, IEngineContext context, IController controller, IControllerContext controllerContext)
		{
			string fileName = GetFileName(templateName);
			IViewBaseInternal view;
			view = GetView(fileName, output, context, controller, controllerContext);
			if (controllerContext.LayoutNames != null)
			{
				string[] layoutNames = controllerContext.LayoutNames;
				for (int i = layoutNames.Length - 1; i >= 0; --i)
				{
					string layoutName = layoutNames[i].Trim();
					IViewBaseInternal layout = GetLayout(layoutName, output, context, controller, controllerContext);
					layout.ContentView = view;
					view = layout;
				}
			}
			if (controller != null)
			{
				controller.PreSendView(view);
			}
			view.Process();
			if (controller != null)
			{
				controller.PostSendView(view);
			}
		}
开发者ID:mgagne-atman,项目名称:Projects,代码行数:26,代码来源:AspViewEngine.cs


注:本文中的IController.PreSendView方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。