Beispiel #1
0
        static Action<TextWriter, object> GetCompiledTemplate([NotNull] string templateString, Type modelType)
        {
            if (templateString == null) throw new ArgumentNullException(nameof(templateString));

            // requires this reference so it pulls this assembly
            var parser = new Veil.Handlebars.HandlebarsParser();
            
            var parsedTemplate = _parsedCache.GetOrAdd(templateString,
                t =>
                {
                    using (var sr = new StringReader(templateString))
                        return Tuple.Create(VailEngine.CompileNonGeneric("handlebars", sr, modelType));
                });

            return parsedTemplate.Item1;
        }
Beispiel #2
0
        static Action <TextWriter, object> GetCompiledTemplate([NotNull] string templateString, Type modelType)
        {
            if (templateString == null)
            {
                throw new ArgumentNullException(nameof(templateString));
            }

            // requires this reference so it pulls this assembly
            var parser = new Veil.Handlebars.HandlebarsParser();

            var parsedTemplate = _parsedCache.GetOrAdd(templateString,
                                                       t =>
            {
                using (var sr = new StringReader(templateString))
                    return(Tuple.Create(VailEngine.CompileNonGeneric("handlebars", sr, modelType)));
            });

            return(parsedTemplate.Item1);
        }