コード例 #1
0
        internal RazorEngineCore(ITemplateServiceConfiguration config, RazorEngineService cached)
        {
            Contract.Requires(config != null);
            Contract.Requires(config.TemplateManager != null);

            _config = config;
            _cached = cached;
        }
コード例 #2
0
ファイル: RazorEngineCore.cs プロジェクト: brigs/RazorEngine
        internal RazorEngineCore(ITemplateServiceConfiguration config, RazorEngineService cached)
        {
            Contract.Requires(config != null);
            Contract.Requires(config.TemplateManager != null);

            _config = config;
            _cached = cached;
        }
コード例 #3
0
 /// <summary>
 /// Create the configuration.
 /// </summary>
 /// <returns></returns>
 public ITemplateServiceConfiguration CreateConfiguration()
 {
     return(new TemplateServiceConfiguration()
     {
         Language = language,
         EncodedStringFactory = RazorEngineService.GetEncodedStringFactory(encoding)
     });
 }
コード例 #4
0
 internal RazorEngineCore(ReadOnlyTemplateServiceConfiguration config, RazorEngineService cached)
 {
     if (config == null)
     {
         throw new ArgumentNullException("config");
     }
     
     _config = config;
     _cached = cached;
 }
コード例 #5
0
        internal RazorEngineCore(ReadOnlyTemplateServiceConfiguration config, RazorEngineService cached)
        {
            if (config == null)
            {
                throw new ArgumentNullException("config");
            }

            _config = config;
            _cached = cached;
        }
コード例 #6
0
        internal RazorEngineCore(ReadOnlyTemplateServiceConfiguration config, RazorEngineService cached)
        {
            if (config == null)
            {
                throw new ArgumentNullException("config");
            }

            _config = config;
            _cached = cached;
            AppDomain.CurrentDomain.AssemblyResolve += AssemblyResolve;
        }
コード例 #7
0
 internal RazorEngineCore(ReadOnlyTemplateServiceConfiguration config, RazorEngineService cached)
 {
     if (config == null)
     {
         throw new ArgumentNullException("config");
     }
     
     _config = config;
     _cached = cached;
     AppDomain.CurrentDomain.AssemblyResolve += AssemblyResolve;
 }
コード例 #8
0
ファイル: Order.cs プロジェクト: chuckconway/bike-distributor
        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));
        }
コード例 #9
0
 internal TemplateService(RazorEngineService service)
 {
     Contract.Requires(service != null);
     _service = service;
 }
コード例 #10
0
 /// <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);
 }
コード例 #11
0
 internal RazorEngineCoreWithCache(ITemplateServiceConfiguration config, RazorEngineService cached)
     : base(config, cached)
 {
 }
コード例 #12
0
 internal RazorEngineCoreWithCache(ITemplateServiceConfiguration config, RazorEngineService cached)
     : base(config, cached)
 {
 }