/// <summary> /// Initializes a new instance of the <see cref="DefaultViewServiceRegistration"/> class. /// </summary> /// <param name="options">The options.</param> /// <exception cref="System.ArgumentNullException">options</exception> public DefaultViewServiceRegistration(DefaultViewServiceOptions options) { if (options == null) { throw new ArgumentNullException("options"); } AdditionalRegistrations.Add(new Registration <DefaultViewServiceOptions>(options)); if (options.ViewLoader == null) { options.ViewLoader = new Registration <IViewLoader, FileSystemWithEmbeddedFallbackViewLoader>(); } if (options.CacheViews) { AdditionalRegistrations.Add(new Registration <IViewLoader>(options.ViewLoader, InnerRegistrationName)); var cache = new ResourceCache(); AdditionalRegistrations.Add(new Registration <IViewLoader>( resolver => new CachingLoader(cache, resolver.Resolve <IViewLoader>(InnerRegistrationName)))); } else { AdditionalRegistrations.Add(options.ViewLoader); } }
/// <summary> /// Initializes a new instance of the <see cref="DefaultViewService"/> class. /// </summary> public DefaultViewService(DefaultViewServiceOptions config, IViewLoader viewLoader) { if (config == null) { throw new ArgumentNullException("config"); } if (viewLoader == null) { throw new ArgumentNullException("viewLoader"); } this.config = config; this.viewLoader = viewLoader; }