CallTemplateToFile() public method

public CallTemplateToFile ( string templateClass, string outputfile ) : void
templateClass string
outputfile string
return void
Exemplo n.º 1
0
        public virtual int ExecuteTemplate(ResourceBasedGenerationHost genHost, string templateFilename, string outputFilename, object[] templateParameters)
        {
            if (genHost == null)
            {
                throw new ArgumentNullException("genHost");
            }

            using (log4net.NDC.Push(templateFilename))
            {
                try
                {
                    if (Log.IsDebugEnabled)
                    {
                        Log.DebugFormat("Executing template");
                    }
                    genHost.Initialize(this.Settings);
                    genHost.CallTemplateToFile(templateFilename, outputFilename, templateParameters);
                    return(0);
                }
                catch (CompilationFailedException ex)
                {
                    Log.Error("Template compilation failed", ex);
                    foreach (CompilerError err in ex.Errors)
                    {
                        Log.WarnFormat("{0} {1}: {2}\r\n  \"{3}\", line #{4}",
                                       err.IsWarning ? "Warning" : "Error",
                                       err.ErrorNumber,
                                       err.ErrorText,
                                       err.FileName,
                                       err.Line);
                    }
                    throw;
                }
            }
        }
Exemplo n.º 2
0
        public virtual int ExecuteTemplate(ResourceBasedGenerationHost genHost, string templateFilename, string outputFilename, object[] templateParameters)
        {
            if (genHost == null) { throw new ArgumentNullException("genHost"); }

            using (log4net.NDC.Push(templateFilename))
            {
                try
                {
                    if (Log.IsDebugEnabled)
                    {
                        Log.DebugFormat("Executing template");
                    }
                    genHost.Initialize(this.Settings);
                    genHost.CallTemplateToFile(templateFilename, outputFilename, templateParameters);
                    return 0;
                }
                catch (CompilationFailedException ex)
                {
                    Log.Error("Template compilation failed", ex);
                    foreach (CompilerError err in ex.Errors)
                    {
                        Log.WarnFormat("{0} {1}: {2}\r\n  \"{3}\", line #{4}",
                            err.IsWarning ? "Warning" : "Error",
                            err.ErrorNumber,
                            err.ErrorText,
                            err.FileName,
                            err.Line);
                    }
                    throw;
                }
            }
        }