public OverloadedLocationViewEngine(IRazorPageFactory pageFactory, IRazorViewFactory viewFactory, IViewLocationExpanderProvider expanderProvider, IViewLocationCache cache) : base(pageFactory, viewFactory, expanderProvider, cache) { }
public OverloadedLocationViewEngine(IRazorPageFactory pageFactory, IRazorViewFactory viewFactory, IOptions <RazorViewEngineOptions> optionsAccessor, IViewLocationCache cache) : base(pageFactory, viewFactory, optionsAccessor, cache) { }
/// <summary> /// Initializes a new instance of the <see cref="MinifiedRazorViewEngine" /> class. /// </summary> /// <param name="pageFactory">The page factory used for creating <see cref="IRazorPage"/> instances.</param> public MinifiedRazorViewEngine( IRazorPageFactory pageFactory, IRazorViewFactory viewFactory, IOptions <RazorViewEngineOptions> optionsAccessor, IViewLocationCache viewLocationCache) : base(pageFactory, viewFactory, optionsAccessor, viewLocationCache) { }
/// <summary> /// Initializes a new instance of the <see cref="MinifiedRazorViewEngine" /> class. /// </summary> /// <param name="pageFactory">The page factory used for creating <see cref="IRazorPage"/> instances.</param> public MinifiedRazorViewEngine( IRazorPageFactory pageFactory, IRazorViewFactory viewFactory, IOptions<RazorViewEngineOptions> optionsAccessor, IViewLocationCache viewLocationCache) : base(pageFactory, viewFactory, optionsAccessor, viewLocationCache) { }
/// <summary> /// Initializes a new instance of the <see cref="RazorViewEngine" /> class. /// </summary> /// <param name="pageFactory">The page factory used for creating <see cref="IRazorPage"/> instances.</param> public RazorViewEngine(IRazorPageFactory pageFactory, IViewLocationExpanderProvider viewLocationExpanderProvider, IViewLocationCache viewLocationCache) { _pageFactory = pageFactory; _viewLocationExpanders = viewLocationExpanderProvider.ViewLocationExpanders; _viewLocationCache = viewLocationCache; }
public void ViewLocationCache_RoundTrips() { // Arrange & Act IViewLocationCache locationCache = _engine.ViewLocationCache; // Assert Assert.NotNull(locationCache); Assert.Equal(_engine.MockCache.Object, _engine.ViewLocationCache); }
/// <summary> /// Initializes a new instance of the <see cref="RazorViewEngine" /> class. /// </summary> /// <param name="pageFactory">The page factory used for creating <see cref="IRazorPage"/> instances.</param> public RazorViewEngine(IRazorPageFactory pageFactory, IRazorViewFactory viewFactory, IOptions <RazorViewEngineOptions> optionsAccessor, IViewLocationCache viewLocationCache) { _pageFactory = pageFactory; _viewFactory = viewFactory; _viewLocationExpanders = optionsAccessor.Options.ViewLocationExpanders; _viewLocationCache = viewLocationCache; }
/// <summary> /// Initializes a new instance of the <see cref="RazorViewEngine" /> class. /// </summary> /// <param name="pageFactory">The page factory used for creating <see cref="IRazorPage"/> instances.</param> public RazorViewEngine(IRazorPageFactory pageFactory, IRazorViewFactory viewFactory, IOptions<RazorViewEngineOptions> optionsAccessor, IViewLocationCache viewLocationCache) { _pageFactory = pageFactory; _viewFactory = viewFactory; _viewLocationExpanders = optionsAccessor.Options.ViewLocationExpanders; _viewLocationCache = viewLocationCache; }
/// <summary> /// Initializes a new instance of the <see cref="RazorViewEngine" /> class. /// </summary> /// <param name="pageFactory">The page factory used for creating <see cref="IRazorPage"/> instances.</param> public RazorViewEngine(IRazorPageFactory pageFactory, IRazorViewFactory viewFactory, IViewLocationExpanderProvider viewLocationExpanderProvider, IViewLocationCache viewLocationCache) { _pageFactory = pageFactory; _viewFactory = viewFactory; _viewLocationExpanders = viewLocationExpanderProvider.ViewLocationExpanders; _viewLocationCache = viewLocationCache; }
public WaCoreRazorViewEngine( IRazorPageFactory pageFactory, IRazorViewFactory viewFactory, IOptions <RazorViewEngineOptions> optionsAccessor, IViewLocationCache viewLocationCache) : base(pageFactory, viewFactory, optionsAccessor, viewLocationCache) { //https://github.com/aspnet/Mvc/blob/dev/src/Microsoft.AspNet.Mvc.Razor/RazorViewEngine.cs // {0} represents the name of the view // {1} represents the name of the controller // {2} represents the name of the area }
public static Response RenderView(this IViewFactory factory, IViewLocationCache cache, NancyContext context, string viewName, object model = null) { var foundMatchingView = cache.Any(x => viewName.Equals(string.Concat(x.Location, "/", x.Name, ".", x.Extension), StringComparison.OrdinalIgnoreCase)); if (foundMatchingView) { var viewContext = new ViewLocationContext { Context = context }; context.Response = factory.RenderView(viewName, model, viewContext); } return context.Response; }
protected PluginViewEngine(PluginContext pluginContext) { if(pluginContext == null) throw new ArgumentNullException("pluginContext"); _pluginContext = pluginContext; if(HttpContext.Current == null || HttpContext.Current.IsDebuggingEnabled) _viewLocationCache = DefaultViewLocationCache.Null; else _viewLocationCache = new DefaultViewLocationCache(); }
public TwoLevelViewLocationCache() { var cacheDuringDebug = CommonHelper.GetAppSetting <bool>("sm:EnableViewLocationCacheDuringDebug"); if (!cacheDuringDebug && (HttpContext.Current == null || HttpContext.Current.IsDebuggingEnabled)) { _innerCache = DefaultViewLocationCache.Null; } else { _innerCache = new DefaultViewLocationCache(TimeSpan.FromHours(2)); } }
public void ViewLocationCache_DefaultNullCache() { // Arrange Mock <VirtualPathProviderViewEngine> engineMock = new Mock <VirtualPathProviderViewEngine>(); VirtualPathProviderViewEngine engine = engineMock.Object; // Act IViewLocationCache cache = engine.ViewLocationCache; // Assert Assert.NotNull(cache); Assert.Equal(DefaultViewLocationCache.Null, cache); Assert.IsNotType <DefaultViewLocationCache>(cache); }
//IRazorViewEngine public CoreViewEngine( IRazorPageFactory pageFactory, IRazorViewFactory viewFactory, IOptions<RazorViewEngineOptions> optionsAccessor, IViewLocationCache viewLocationCache):base(pageFactory, viewFactory, optionsAccessor, viewLocationCache) { //https://github.com/aspnet/Mvc/blob/dev/src/Microsoft.AspNet.Mvc.Razor/RazorViewEngine.cs // {0} represents the name of the view // {1} represents the name of the controller // {2} represents the name of the area }
private IViewEngine CreateViewEngine(IRazorPageFactory pageFactory = null, IEnumerable <IViewLocationExpander> expanders = null, IViewLocationCache cache = null) { pageFactory = pageFactory ?? Mock.Of <IRazorPageFactory>(); cache = cache ?? GetViewLocationCache(); var viewLocationExpanderProvider = GetViewLocationExpanders(expanders); var viewEngine = new RazorViewEngine(pageFactory, viewLocationExpanderProvider, cache); return(viewEngine); }
private RazorViewEngine CreateViewEngine(IRazorPageFactory pageFactory = null, IRazorViewFactory viewFactory = null, IEnumerable <IViewLocationExpander> expanders = null, IViewLocationCache cache = null) { pageFactory = pageFactory ?? Mock.Of <IRazorPageFactory>(); viewFactory = viewFactory ?? Mock.Of <IRazorViewFactory>(); cache = cache ?? GetViewLocationCache(); var viewEngine = new RazorViewEngine(pageFactory, viewFactory, GetOptionsAccessor(expanders), cache); return(viewEngine); }
protected PluginViewEngine(PluginContext pluginContext) { if (pluginContext == null) { throw new ArgumentNullException("pluginContext"); } _pluginContext = pluginContext; if (HttpContext.Current == null || HttpContext.Current.IsDebuggingEnabled) { _viewLocationCache = DefaultViewLocationCache.Null; } else { _viewLocationCache = new DefaultViewLocationCache(); } }
/// <summary>实例化</summary> /// <param name="assemblyName"></param> /// <param name="innerCache"></param> public PrecompiledViewLocationCache(String assemblyName, IViewLocationCache innerCache) { _assemblyName = assemblyName; _innerCache = innerCache; }
public TwoLevelViewCache(IViewLocationCache cache) { _cache = cache; }
public ViewEngineStartupFixture() { this.viewCache = A.Fake<IViewCache>(); this.viewLocationCache = A.Fake<IViewLocationCache>(); A.CallTo(() => this.viewLocationCache.GetEnumerator()).ReturnsLazily(() => this.views.GetEnumerator()); }
public TwoLevelViewCache(IViewLocationCache secondLevelCache) { _secondLevelCache = secondLevelCache; }
private static DefaultViewLocator CreateViewLocator(IViewLocationCache viewLocationCache) { return new DefaultViewLocator(viewLocationCache); }
public ViewLocationCached(IViewLocationCache cache) { _cache = cache; }
public DefaultViewEngine(IRazorPageFactory pageFactory, IRazorViewFactory viewFactory, IViewLocationExpanderProvider viewLocationExpanderProvider, IViewLocationCache viewLocationCache) : base(pageFactory, viewFactory, viewLocationExpanderProvider, viewLocationCache) { }
private static DefaultViewLocator CreateViewLocator(IViewLocationCache viewLocationCache) { return(new DefaultViewLocator(viewLocationCache)); }
public DefaultViewLocator(IViewLocationCache viewLocationCache) { this.viewLocationCache = viewLocationCache; }
public PrecompiledViewLocationCache(IViewLocationCache innerCache) { _prexif = "precompiled"; _innerCache = innerCache; }
private RazorViewEngine CreateViewEngine( IRazorPageFactory pageFactory = null, IRazorViewFactory viewFactory = null, IEnumerable<IViewLocationExpander> expanders = null, IViewLocationCache cache = null) { pageFactory = pageFactory ?? Mock.Of<IRazorPageFactory>(); viewFactory = viewFactory ?? Mock.Of<IRazorViewFactory>(); cache = cache ?? GetViewLocationCache(); var viewEngine = new RazorViewEngine(pageFactory, viewFactory, GetOptionsAccessor(expanders), cache); return viewEngine; }
public PortalViewEngine(IControllerFileService controllerFileService, IViewLocationCache viewLocationCache) { this.controllerFileService = controllerFileService; this.viewLocationCache = viewLocationCache; }
public PrecompiledViewLocationCache(string assemblyName, IViewLocationCache innerCache) { _assemblyName = assemblyName; _innerCache = innerCache; }
public DefaultViewLocatorFixture() { this.viewLocation = new ViewLocationResult("location", "view", "html", null); this.viewLocationCache = new FakeViewLocationCache(this.viewLocation); this.viewLocator = CreateViewLocator(this.viewLocationCache); }
public ViewEngineStartup(IEnumerable<IViewEngine> viewEngines, IViewLocationCache viewLocationCache, IViewCache viewCache) { this.viewEngines = viewEngines; this.viewLocationCache = viewLocationCache; this.viewCache = viewCache; }
public ViewLocationCache(IViewLocationCache locache) { cache = locache; }
public Generic404ErrorHandler(IViewFactory factory, IViewLocationCache cache) { _factory = factory; _cache = cache; }
public ViewEngineStartup(IEnumerable <IViewEngine> viewEngines, IViewLocationCache viewLocationCache, IViewCache viewCache) { this.viewEngines = viewEngines; this.viewLocationCache = viewLocationCache; this.viewCache = viewCache; }
public ViewEngineStartupFixture() { this.viewCache = A.Fake <IViewCache>(); this.viewLocationCache = A.Fake <IViewLocationCache>(); A.CallTo(() => this.viewLocationCache.GetEnumerator()).ReturnsLazily(() => this.views.GetEnumerator()); }
public OverloadedLocationViewEngine( IRazorPageFactory pageFactory, IRazorViewFactory viewFactory, IOptions<RazorViewEngineOptions> optionsAccessor, IViewLocationCache cache) : base(pageFactory, viewFactory, optionsAccessor, cache) { }