/// <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); _config = config; _loader = new TypeLoader(AppDomain.CurrentDomain, _assemblies); }
/// <summary> /// Initialises a new instance of <see cref="TemplateService"/> /// </summary> /// <param name="config">The template service configuration.</param> internal RazorEngineService(ITemplateServiceConfiguration config) { Contract.Requires(config != null); _config = config; //_core = new RazorEngineCore(config, this); _core_with_cache = new RazorEngineCoreWithCache(config, this); }
internal RazorEngineCore(ITemplateServiceConfiguration config, RazorEngineService cached) { Contract.Requires(config != null); Contract.Requires(config.TemplateManager != null); _config = config; _cached = cached; }
internal RazorEngineCore(ITemplateServiceConfiguration config, RazorEngineService cached) { Contract.Requires(config != null); Contract.Requires(config.TemplateManager != null); _config = config; _cached = cached; }
/// <summary> /// Initialises a new instance of <see cref="TemplateService"/> /// </summary> /// <param name="config">The template service configuration.</param> internal RazorEngineService(ITemplateServiceConfiguration config) { Contract.Requires(config != null); _config = config; //_core = new RazorEngineCore(config, this); _core_with_cache = new RazorEngineCoreWithCache(config, this); }
public CSJSHandler() { config = new TemplateServiceConfiguration { ReferenceResolver = new CSJSReferenceResolver(), BaseTemplateType = typeof(CSJSSupportTemplateBase <>) }; service = RazorEngineService.Create(config); }
public RazorService(ITemplateServiceConfiguration configuration) { if (configuration == null) { throw new ArgumentNullException("configuration"); } _templateService = new TemplateService(configuration); }
/// <summary> /// Initializes a new <see cref="RazorViewParser"/> with the specified <paramref name="ITemplateServiceConfiguration"/>. /// </summary> /// <param name="config">The <see cref="ITemplateServiceConfiguration"/>.</param> public RazorViewParser(ITemplateServiceConfiguration config) { if (config == null) { throw new ArgumentNullException("config"); } _templateService = new TemplateService(config); }
protected override void beforeEach() { _config = new TemplateServiceConfiguration(); _config.Namespaces.Clear(); var templateService = new FubuTemplateService(new TemplateRegistry <IRazorTemplate>(), new TemplateService(_config), new FileSystem()); Services.Inject(_config); Services.Inject <IFubuTemplateService>(templateService); ClassUnderTest.Activate(Enumerable.Empty <IPackageInfo>(), MockFor <IPackageLog>()); }
/// <summary> /// Initialises a new instance of <see cref="TemplateService"/> /// </summary> /// <param name="config">The template service configuration.</param> internal RazorEngineService(ITemplateServiceConfiguration config) { Contract.Requires(config != null); if (config.Debug && config.DisableTempFileLocking) { throw new InvalidOperationException("Debug && DisableTempFileLocking is not supported, you need to disable one of them. When Roslyn has been released and you are seeing this, open an issue as this might be possible now."); } _config = config; //_core = new RazorEngineCore(config, this); _core_with_cache = new RazorEngineCoreWithCache(config, this); }
/// <summary> /// Initialises a new instance of <see cref="TemplateService"/> /// </summary> /// <param name="config">The template service configuration.</param> internal RazorEngineService(ITemplateServiceConfiguration config) { Contract.Requires(config != null); if (config.Debug && config.DisableTempFileLocking) { throw new InvalidOperationException("Debug && DisableTempFileLocking is not supported, you need to disable one of them. When Roslyn has been released and you are seeing this, open an issue as this might be possible now."); } _config = config; //_core = new RazorEngineCore(config, this); _core_with_cache = new RazorEngineCoreWithCache(config, this); }
public RazorMailer(ITemplateServiceConfiguration config, IEmailResolver emailResolver) { if (config == null) { throw new ArgumentNullException("config"); } if (config.Resolver == null) { throw new ArgumentException("Custom configuration must specify a resolver"); } if (emailResolver == null) { throw new ArgumentNullException("emailResolver"); } this.emailResolver = emailResolver; this.templateResolver = config.Resolver; this.templateService = new TemplateService(config); }
/// <summary> /// Create a new readonly view (and copy) of the given configuration. /// </summary> /// <param name="config">the configuration to copy.</param> public ReadOnlyTemplateServiceConfiguration(ITemplateServiceConfiguration config) { if (config == null) { throw new ArgumentNullException("config"); } _allowMissingPropertiesOnDynamic = config.AllowMissingPropertiesOnDynamic; _activator = config.Activator; if (_activator == null) { throw new ArgumentNullException("config", "the configured Activator cannot be null!"); } _baseTemplateType = config.BaseTemplateType; // Check if the baseTemplateType is valid. if (_baseTemplateType != null && (!typeof(ITemplate).IsAssignableFrom(_baseTemplateType) || typeof(ITemplate) == _baseTemplateType)) { throw new ArgumentOutOfRangeException("config", "the configured BaseTemplateType must implement ITemplate!"); } _cachingProvider = config.CachingProvider; if (_cachingProvider == null) { throw new ArgumentNullException("config", "the configured CachingProvider cannot be null!"); } _compilerServiceFactory = config.CompilerServiceFactory; if (_compilerServiceFactory == null) { throw new ArgumentNullException("config", "the configured CompilerServiceFactory cannot be null!"); } _debug = config.Debug; _disableTempFileLocking = config.DisableTempFileLocking; _encodedStringFactory = config.EncodedStringFactory; if (_encodedStringFactory == null) { throw new ArgumentNullException("config", "the configured EncodedStringFactory cannot be null!"); } _language = config.Language; _namespaces = config.Namespaces; if (_namespaces == null) { throw new ArgumentNullException("config", "the configured Namespaces cannot be null!"); } _namespaces = new HashSet <string>(_namespaces); _referenceResolver = config.ReferenceResolver; if (_referenceResolver == null) { throw new ArgumentNullException("config", "the configured ReferenceResolver cannot be null!"); } _templateManager = config.TemplateManager; if (_templateManager == null) { throw new ArgumentNullException("config", "the configured TemplateManager cannot be null!"); } ConfigureCompilerBuilder = config.ConfigureCompilerBuilder; }
private EmailService(ITemplateServiceConfiguration configuration, bool isolated = false, Func <SmtpClient> createSmtpClient = null) : this(isolated ? IsolatedRazorEngineService.Create() : RazorEngineService.Create(configuration), createSmtpClient) { }
/// <summary> /// Create a new readonly view (and copy) of the given configuration. /// </summary> /// <param name="config">the configuration to copy.</param> public ReadOnlyTemplateServiceConfiguration(ITemplateServiceConfiguration config) { if (config == null) { throw new ArgumentNullException("config"); } _allowMissingPropertiesOnDynamic = config.AllowMissingPropertiesOnDynamic; _activator = config.Activator; if (_activator == null) { throw new ArgumentNullException("config", "the configured Activator cannot be null!"); } _baseTemplateType = config.BaseTemplateType; // Check if the baseTemplateType is valid. if (_baseTemplateType != null && (!typeof(ITemplate).IsAssignableFrom(_baseTemplateType) || typeof(ITemplate) == _baseTemplateType)) { throw new ArgumentOutOfRangeException("config", "the configured BaseTemplateType must implement ITemplate!"); } _cachingProvider = config.CachingProvider; if (_cachingProvider == null) { throw new ArgumentNullException("config", "the configured CachingProvider cannot be null!"); } #if !RAZOR4 #pragma warning disable 0618 // Backwards Compat. _codeInspectors = config.CodeInspectors; if (_codeInspectors == null) { throw new ArgumentNullException("config", "the configured CodeInspectos cannot be null!"); } _codeInspectors = new List<ICodeInspector>(_codeInspectors); #pragma warning restore 0618 // Backwards Compat. #endif _compilerServiceFactory = config.CompilerServiceFactory; if (_compilerServiceFactory == null) { throw new ArgumentNullException("config", "the configured CompilerServiceFactory cannot be null!"); } _debug = config.Debug; _disableTempFileLocking = config.DisableTempFileLocking; _encodedStringFactory = config.EncodedStringFactory; if (_encodedStringFactory == null) { throw new ArgumentNullException("config", "the configured EncodedStringFactory cannot be null!"); } _language = config.Language; _namespaces = config.Namespaces; if (_namespaces == null) { throw new ArgumentNullException("config", "the configured Namespaces cannot be null!"); } _namespaces = new HashSet<string>(_namespaces); _referenceResolver = config.ReferenceResolver; if (_referenceResolver == null) { throw new ArgumentNullException("config", "the configured ReferenceResolver cannot be null!"); } #pragma warning disable 0618 // Backwards Compat. _resolver = config.Resolver; _templateManager = config.TemplateManager; if (_templateManager == null) { if (_resolver != null) { _templateManager = new Xml.WrapperTemplateManager(_resolver); } else { throw new ArgumentNullException("config", "the configured TemplateManager and Resolver cannot be null!"); } } #pragma warning restore 0618 // Backwards Compat. }
/// <summary> /// Initializes a new <see cref="RazorViewParser"/> with the specified <paramref name="ITemplateServiceConfiguration"/>. /// </summary> /// <param name="config">The <see cref="ITemplateServiceConfiguration"/>.</param> public RazorViewParser(ITemplateServiceConfiguration config) { if (config == null) throw new ArgumentNullException("config"); _templateService = new TemplateService(config); }
public RazorActivator(ITemplateServiceConfiguration engine) { _engine = engine; }
internal RazorEngineCoreWithCache(ITemplateServiceConfiguration config, RazorEngineService cached) : base(config, cached) { }
/// <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); }
public TemplateServiceXml(ITemplateServiceConfiguration config) { _templateService = new TemplateService(config); }
/// <summary> /// Creates a new <see cref="IRazorEngineService"/> instance with the given configuration. /// </summary> /// <returns></returns> public static IRazorEngineService Create(ITemplateServiceConfiguration config) { return new DynamicWrapperService(new RazorEngineService(config), false, config.AllowMissingPropertiesOnDynamic); }
public RazorActivator(ITemplateServiceConfiguration engine) { _engine = engine; }
/// <summary> /// Creates a new instance of the <see cref="EmailService"/> class /// with the specified Razor Engine configuration and, optionally, a /// delegate to create an <see cref="SmtpClient"/>. /// </summary> /// <param name="configuration">An <see cref="RazorEngine.Configuration.ITemplateServiceConfiguration"/> instance.</param> /// <param name="isolated"></param> /// <param name="createSmtpClient">A delegate to create an <see cref="SmtpClient"/> instance or <see langword="null"/> /// to use a default delegate.</param> public static EmailService Create(ITemplateServiceConfiguration configuration, bool isolated = false, Func <SmtpClient> createSmtpClient = null) { return(new EmailService(configuration, isolated, createSmtpClient)); }
internal RazorEngineCoreWithCache(ITemplateServiceConfiguration config, RazorEngineService cached) : base(config, cached) { }
/// <summary> /// Initializes a new <see cref="LanguageEncodingConfigCreator"/> instance /// </summary> /// <param name="language"></param> /// <param name="encoding"></param> public SandBoxConfigCreator(ITemplateServiceConfiguration _config) { config = _config; }
/// <summary> /// Create a new readonly view (and copy) of the given configuration. /// </summary> /// <param name="config">the configuration to copy.</param> public ReadOnlyTemplateServiceConfiguration(ITemplateServiceConfiguration config) { if (config == null) { throw new ArgumentNullException("config"); } _allowMissingPropertiesOnDynamic = config.AllowMissingPropertiesOnDynamic; _activator = config.Activator; if (_activator == null) { throw new ArgumentNullException("config", "the configured Activator cannot be null!"); } _baseTemplateType = config.BaseTemplateType; // Check if the baseTemplateType is valid. if (_baseTemplateType != null && (!typeof(ITemplate).IsAssignableFrom(_baseTemplateType) || typeof(ITemplate) == _baseTemplateType)) { throw new ArgumentOutOfRangeException("config", "the configured BaseTemplateType must implement ITemplate!"); } _cachingProvider = config.CachingProvider; if (_cachingProvider == null) { throw new ArgumentNullException("config", "the configured CachingProvider cannot be null!"); } #if !RAZOR4 #pragma warning disable 0618 // Backwards Compat. _codeInspectors = config.CodeInspectors; if (_codeInspectors == null) { throw new ArgumentNullException("config", "the configured CodeInspectos cannot be null!"); } _codeInspectors = new List <ICodeInspector>(_codeInspectors); #pragma warning restore 0618 // Backwards Compat. #endif _compilerServiceFactory = config.CompilerServiceFactory; if (_compilerServiceFactory == null) { throw new ArgumentNullException("config", "the configured CompilerServiceFactory cannot be null!"); } _debug = config.Debug; _disableTempFileLocking = config.DisableTempFileLocking; _encodedStringFactory = config.EncodedStringFactory; if (_encodedStringFactory == null) { throw new ArgumentNullException("config", "the configured EncodedStringFactory cannot be null!"); } _language = config.Language; _namespaces = config.Namespaces; if (_namespaces == null) { throw new ArgumentNullException("config", "the configured Namespaces cannot be null!"); } _namespaces = new HashSet <string>(_namespaces); _referenceResolver = config.ReferenceResolver; if (_referenceResolver == null) { throw new ArgumentNullException("config", "the configured ReferenceResolver cannot be null!"); } _templateManager = config.TemplateManager; #if NO_CONFIGURATION if (_templateManager == null) { throw new ArgumentNullException("config", "the configured TemplateManager cannot be null!"); } #else #pragma warning disable 0618 // Backwards Compat. _resolver = config.Resolver; if (_templateManager == null) { if (_resolver != null) { _templateManager = new Xml.WrapperTemplateManager(_resolver); } else { throw new ArgumentNullException("config", "the configured TemplateManager and Resolver cannot be null!"); } } #pragma warning restore 0618 // Backwards Compat. #endif ConfigureCompilerBuilder = config.ConfigureCompilerBuilder; }
/// <summary> /// Creates a new <see cref="IRazorEngineService"/> instance with the given configuration. /// </summary> /// <returns></returns> public static IRazorEngineService Create(ITemplateServiceConfiguration config) { return(new DynamicWrapperService(new RazorEngineService(config), false, config.AllowMissingPropertiesOnDynamic)); }
public RazorActivator (ITemplateServiceConfiguration engine, CommonViewNamespaces namespaces) { _engine = engine; _namespaces = namespaces; }