Compile() static private method

static private Compile ( Type templateType, string templateBody, IEnumerable assemblyFileNames, IEnumerable namespaces, string tempDirectory ) : TemplateCompilationResult
templateType System.Type
templateBody string
assemblyFileNames IEnumerable
namespaces IEnumerable
tempDirectory string
return TemplateCompilationResult
 internal TemplateCompilationResult InternalCompile(string source)
 {
     return(TemplateCompiler.Compile(
                typeof(T),
                source,
                _namespaces,
                CompilationDirectory));
 }
Example #2
0
 internal TemplateCompilationResult InternalCompile <TModel>(string source)
 {
     return(TemplateCompiler.Compile(
                typeof(TemplateBase <TModel>),
                source,
                _assemblyFileNames,
                _namespaces,
                CompilationDirectory));
 }
Example #3
0
        /// <summary>
        /// Returns strong typed template created from specified source.
        /// </summary>
        public static ITemplate <TModel> Compile <TModel>(string source)
        {
            if (string.IsNullOrEmpty(source))
            {
                throw new ArgumentException(
                          "Template source can't be null or empty string.",
                          "source");
            }

            var compilationResult = TemplateCompiler.Compile(
                typeof(TemplateBase <TModel>),
                source,
                Enumerable.Empty <string>() /* namespaces */,
                null /* compilation directory */);

            return(new Template <TemplateBase <TModel>, TModel>(compilationResult.Type, compilationResult.SourceCode, null));
        }