///-------------------------------------------------------------------------------- /// <summary>This method generates the associated output path for the template.</summary> /// /// <param name="parentModelContext">The parent model context from which to generate code.</param> /// /// <returns>A string representing the generated code for the template.</returns> ///-------------------------------------------------------------------------------- public string GenerateOutput(IDomainEnterpriseObject parentModelContext) { try { MessageBuilder.Clear(); OutputCodeBuilder.Clear(); Parameters.Clear(); Variables.Clear(); if (OutputAST == null) { ParseOutput(Solution.IsSampleMode); } IDomainEnterpriseObject context = GetTemplateModelContext(parentModelContext); if (OutputAST != null && OutputAST.ChildNodes.Count > 0) { OutputAST.InterpretNode(InterpreterTypeCode.Output, Solution, this, context, null); OutputCode = OutputCodeBuilder.ToString() + MessageBuilder.ToString(); } return(OutputCode); } catch (ApplicationAbortException) { throw; } catch (System.Exception ex) { HasErrors = true; Solution.ShowIssue(ex.Message + ex.StackTrace, DisplayValues.Exception_CodeGenerationTitle, Solution.IsSampleMode); } return(null); }
///-------------------------------------------------------------------------------- /// <summary>This method generates the associated output path for the template. By not /// supplying a model context, the generated code is generally suitable as a /// sample only.</summary> /// /// <returns>A string representing the generated code for the template.</returns> ///-------------------------------------------------------------------------------- public string GenerateOutput() { try { return(GenerateOutput(GetMostRelevantSampleContext())); } catch (ApplicationAbortException) { // abort with whatever content is available OutputCode = OutputCodeBuilder.ToString() + MessageBuilder.ToString(); return(OutputCode); } }