Пример #1
0
        public string Generate(string template, object model)
        {
            if (_engine == null)
            {
                _engine = EngineFactory.CreatePhysical(Configuration.GetProjectDirectory());
                Assert.IsNotNull(_engine);

                _engine.Configuration.Namespaces.AddRange(Configuration.GetArray(Constants.Configuration.GenerateCode.Imports));
            }

            return(_engine.ParseString(template, model));
        }
Пример #2
0
 /// <summary>
 /// Parses a string
 /// </summary>
 /// <typeparam name="T">Type of the model</typeparam>
 /// <param name="content">Template to parse</param>
 /// <param name="model">Template model</param>
 /// <returns>Returns parsed string</returns>
 /// <remarks>Result is not cached</remarks>
 public static string ParseString <T>(this IRazorLightEngine engine, string content, T model)
 {
     return(engine.ParseString(content, model, typeof(T)));
 }