protected override TemplateInfo GetTemplateInfo(string templateBody, Dictionary<string, Type> globalsTypes,
            Dictionary<string, string> inlineTemplates, List<Assembly> referencedAssemblies)
        {
            lock (m_CacheLock)
            {
                // Create template info
                TemplateInfo ti = new TemplateInfo()
                {
                    TemplateBody = templateBody,
                    TemplateHash = null,
                    GlobalsTypes = globalsTypes,
                    ReferencedAssemblies = referencedAssemblies,
                    InlineTemplates = inlineTemplates,
                    TemplateRenderMethod = null
                };

                // Compile Template to TALPrograms and generate the TemplateHash
                TALCompiler.CompileTemplate(ti);

                // Generated template found in cache
                if (m_Cache.ContainsKey(ti.TemplateHash))
                {
                    return m_Cache[ti.TemplateHash];
                }

                // Generate source
                SourceGenerator sourceGenerator = new SourceGenerator();
                ti.GeneratedSourceCode = sourceGenerator.GenerateSource(ti);

                // Generate assembly
                AssemblyGenerator assemblyCompiler = new AssemblyGenerator();
                Assembly assembly = assemblyCompiler.GenerateAssembly(ti, true, null, null);

                // Try to load the Render() method from assembly
                ti.TemplateRenderMethod = GetTemplateRenderMethod(assembly, ti);

                m_Cache.Add(ti.TemplateHash, ti);

                return ti;
            }
        }
        protected override TemplateInfo GetTemplateInfo(string templateBody, Dictionary<string, Type> globalsTypes,
            Dictionary<string, string> inlineTemplates, List<Assembly> referencedAssemblies)
        {
            lock (m_CacheLock)
            {
                // Cache is empty, load templates from cache folder
                if (m_Cache == null)
                {
                    m_Cache = LoadTemplatesInfo(m_CacheFolder);
                }

                // Create template info
                TemplateInfo ti = new TemplateInfo()
                {
                    TemplateBody = templateBody,
                    TemplateHash = null,
                    GlobalsTypes = globalsTypes,
                    ReferencedAssemblies = referencedAssemblies,
                    InlineTemplates = inlineTemplates,
                    TemplateRenderMethod = null
                };

                // Compile Template to TALPrograms and generate the TemplateHash
                TALCompiler.CompileTemplate(ti);

                // Generated template found in cache
                if (m_Cache.ContainsKey(ti.TemplateHash))
                {
                    return m_Cache[ti.TemplateHash];
                }

                // Path to output assembly
                string assemblyFileName = m_Pattern.Replace("{key}", ti.TemplateHash);
                string assemblyPath = Path.Combine(m_CacheFolder, assemblyFileName);

                // Generate source
                SourceGenerator sourceGenerator = new SourceGenerator();
                ti.GeneratedSourceCode = sourceGenerator.GenerateSource(ti);

                // Generate assembly
                AssemblyGenerator assemblyCompiler = new AssemblyGenerator();
                Assembly assembly = assemblyCompiler.GenerateAssembly(ti, false, assemblyPath, null);

                // Try to load the Render() method from assembly
                ti.TemplateRenderMethod = GetTemplateRenderMethod(assembly, ti);

                m_Cache.Add(ti.TemplateHash, ti);

                return ti;
            }
        }