public HomeModule(IViewLocationProvider viewLocationProvider) { this.viewLocationProvider = viewLocationProvider; Get["/"] = _ => { var popularposts = GetModel(); dynamic postModel = new ExpandoObject(); postModel.PopularPosts = popularposts; postModel.MetaData = popularposts; return(View["blogindex", postModel]); }; Get["/{viewname}"] = parameters => { var popularposts = GetModel(); dynamic postModel = new ExpandoObject(); postModel.PopularPosts = popularposts; postModel.MetaData = popularposts.FirstOrDefault(x => x.Slug == parameters.viewname); return(View["Posts/" + parameters.viewname, postModel]); }; }
public HomeModule(IViewLocationProvider viewLocationProvider) { this.viewLocationProvider = viewLocationProvider; Get["/"] = _ => { var popularposts = GetModel(); dynamic postModel = new ExpandoObject(); postModel.PopularPosts = popularposts; postModel.MetaData = popularposts; return View["blogindex", postModel]; }; Get["/{viewname}"] = parameters => { var popularposts = GetModel(); dynamic postModel = new ExpandoObject(); postModel.PopularPosts = popularposts; postModel.MetaData = popularposts.FirstOrDefault(x => x.Slug == parameters.viewname); return View["Posts/" + parameters.viewname, postModel]; }; }
/// <summary> /// Initializes a new instance of the <see cref="DefaultViewLocator"/> class. /// </summary> /// <param name="viewLocationProvider">An <see cref="IViewLocationProvider"/> instance.</param> /// <param name="viewEngines">An <see cref="IEnumerable{T}"/> of <see cref="IViewEngine"/> instances.</param> /// <param name="environment">An <see cref="INancyEnvironment"/> instance.</param> public DefaultViewLocator(IViewLocationProvider viewLocationProvider, IEnumerable <IViewEngine> viewEngines, INancyEnvironment environment) { this.viewLocationProvider = viewLocationProvider; this.viewEngines = viewEngines; this.invalidCharacters = Path.GetInvalidFileNameChars().Where(c => c != '/').ToArray(); this.viewLocationResults = new List <ViewLocationResult>(this.GetInititialViewLocations()); this.configuration = environment.GetValue <ViewConfiguration>(); }
public DefaultViewLocator(IViewLocationProvider viewLocationProvider, IEnumerable<IViewEngine> viewEngines) { this.viewLocationProvider = viewLocationProvider; this.viewEngines = viewEngines; // No need to lock here, we get constructed on app startup this.viewLocationResults = new List<ViewLocationResult>(this.GetInititialViewLocations()); }
/// <summary> /// Initializes a new instance of the <see cref="DefaultViewLocator"/> class. /// </summary> /// <param name="viewLocationProvider">An <see cref="IViewLocationProvider"/> instance.</param> /// <param name="viewEngines">An <see cref="IEnumerable{T}"/> of <see cref="IViewEngine"/> instances.</param> /// <param name="environment">An <see cref="INancyEnvironment"/> instance.</param> public DefaultViewLocator(IViewLocationProvider viewLocationProvider, IEnumerable<IViewEngine> viewEngines, INancyEnvironment environment) { this.viewLocationProvider = viewLocationProvider; this.viewEngines = viewEngines; this.invalidCharacters = Path.GetInvalidFileNameChars().Where(c => c != '/').ToArray(); this.viewLocationResults = new List<ViewLocationResult>(this.GetInititialViewLocations()); this.configuration = environment.GetValue<ViewConfiguration>(); }
public DefaultModule(IArticleReader articleReader, IRouteLocatorProvider routeLocatorProvider, IViewLocationProvider viewLocationProvider) { _articleReader = articleReader; _routeLocatorProvider = routeLocatorProvider; _viewLocationProvider = viewLocationProvider; SetupDateRoutes(); SetupStaticRoutes(); }
public DefaultViewLocator(IViewLocationProvider viewLocationProvider, IEnumerable<IViewEngine> viewEngines) { this.viewLocationProvider = viewLocationProvider; this.viewEngines = viewEngines; this.invalidCharacters = Path.GetInvalidFileNameChars().Where(c => c != '/').ToArray(); // No need to lock here, we get constructed on app startup this.viewLocationResults = new List<ViewLocationResult>(this.GetInititialViewLocations()); }
public DefaultViewLocator(IViewLocationProvider viewLocationProvider, IEnumerable <IViewEngine> viewEngines) { this.viewLocationProvider = viewLocationProvider; this.viewEngines = viewEngines; this.invalidCharacters = Path.GetInvalidFileNameChars().Where(c => c != '/').ToArray(); // No need to lock here, we get constructed on app startup this.viewLocationResults = new List <ViewLocationResult>(this.GetInititialViewLocations()); }
public DefaultViewLocationCache(IViewLocationProvider viewLocationProvider, IEnumerable <IViewEngine> viewEngines) { this.viewLocationProvider = viewLocationProvider; this.viewEngines = viewEngines; this.locatedViews = GetLocatedViews(); }
public DefaultViewLocationCache(IViewLocationProvider viewLocationProvider, IEnumerable<IViewEngine> viewEngines) { this.viewLocationProvider = viewLocationProvider; this.viewEngines = viewEngines; this.locatedViews = GetLocatedViews(); }
private static DefaultViewLocationCache CreateViewLocationCache(IViewLocationProvider viewLocationProvider, IEnumerable<IViewEngine> viewEngines) { return new DefaultViewLocationCache(viewLocationProvider, viewEngines); }
private static DefaultViewLocationCache CreateViewLocationCache(IViewLocationProvider viewLocationProvider, IEnumerable <IViewEngine> viewEngines) { return(new DefaultViewLocationCache(viewLocationProvider, viewEngines)); }
/// <summary> /// Configures the bootstrapper to use the provided instance of <see cref="IViewLocationProvider"/>. /// </summary> /// <param name="viewLocationProvider">The <see cref="IViewLocationProvider"/> instance that should be used by the bootstrapper.</param> /// <returns>An instance to the current <see cref="FakeNancyBootstrapperConfigurator"/>.</returns> public FakeNancyBootstrapperConfigurator ViewLocationProvider(IViewLocationProvider viewLocationProvider) { this.bootstrapper.configuredEnumerableInstances[typeof(IViewLocationProvider)] = new[] { viewLocationProvider }; return(this); }