/// <summary> /// Executes the basic flow which is /// <list type="number"> /// <item><description>Resolve the <see cref="ActiveRecordModel"/></description></item> /// <item><description>Resolve the layout (if not is associated with the controller, defaults to "scaffold")</description></item> /// <item><description>Invokes <see cref="PerformActionProcess"/> which should perform the correct process for this action</description></item> /// <item><description>Resolves the template name that the developer might provide by using <see cref="ComputeTemplateName"/></description></item> /// <item><description>If the template exists, renders it. Otherwise invokes <see cref="RenderStandardHtml"/></description></item> /// </list> /// </summary> /// <param name="controller"></param> public void Execute(Controller controller) { // We make sure the code is always surrounded by a SessionScope. // If none is found, we create one SessionScope scope = null; if (SessionScope.Current == null) { scope = new SessionScope(FlushAction.Never); } try { model = GetARModel(); PerformActionProcess(controller); String templateName = ComputeTemplateName(controller); if (controller.HasTemplate(templateName)) { controller.RenderSharedView(templateName); } else { RenderStandardHtml(controller); } } finally { if (scope != null) { scope.Dispose(); } } }