internal RazorEngineCore(ITemplateServiceConfiguration config, RazorEngineService cached) { Contract.Requires(config != null); Contract.Requires(config.TemplateManager != null); _config = config; _cached = cached; }
/// <summary> /// Create the configuration. /// </summary> /// <returns></returns> public ITemplateServiceConfiguration CreateConfiguration() { return(new TemplateServiceConfiguration() { Language = language, EncodedStringFactory = RazorEngineService.GetEncodedStringFactory(encoding) }); }
internal RazorEngineCore(ReadOnlyTemplateServiceConfiguration config, RazorEngineService cached) { if (config == null) { throw new ArgumentNullException("config"); } _config = config; _cached = cached; }
internal RazorEngineCore(ReadOnlyTemplateServiceConfiguration config, RazorEngineService cached) { if (config == null) { throw new ArgumentNullException("config"); } _config = config; _cached = cached; AppDomain.CurrentDomain.AssemblyResolve += AssemblyResolve; }
private static string CompileTemplate(Receipt model, string resourceName, string templateKey) { var assembly = Assembly.GetExecutingAssembly(); var template = string.Empty; using (var stream = assembly.GetManifestResourceStream(resourceName)) using (var reader = new StreamReader(stream)) { template = reader.ReadToEnd(); } var config = new TemplateServiceConfiguration { EncodedStringFactory = new RawStringFactory() }; Engine.Razor = RazorEngineService.Create(config); return(Engine.Razor.RunCompile(template, templateKey, null, model)); }
internal TemplateService(RazorEngineService service) { Contract.Requires(service != null); _service = service; }
/// <summary> /// Initialises a new instance of <see cref="TemplateService"/> /// </summary> /// <param name="config">The template service configuration.</param> public TemplateService(ITemplateServiceConfiguration config) { Contract.Requires(config != null); _service = new RazorEngineService(config); }
internal RazorEngineCoreWithCache(ITemplateServiceConfiguration config, RazorEngineService cached) : base(config, cached) { }