protected override void RequestStartup(Nancy.TinyIoc.TinyIoCContainer container, Nancy.Bootstrapper.IPipelines pipelines, NancyContext context) { base.RequestStartup(container, pipelines, context); var configuration = new StatelessAuthenticationConfiguration(GetLoadAuthenticationHook); StatelessAuthentication.Enable(pipelines, configuration); pipelines.AfterRequest.AddItemToEndOfPipeline( (ctx) => { var session = container.Resolve<IDocumentSession>(); if (session == null) return; session.SaveChanges(); session.Dispose(); }); //pipelines.BeforeRequest.AddItemToStartOfPipeline(GetLoadAuthenticationHook(configuration)); pipelines.AfterRequest.AddItemToEndOfPipeline(GetRedirectToLoginHook()); }
protected override void ApplicationStartup(Nancy.TinyIoc.TinyIoCContainer container, Nancy.Bootstrapper.IPipelines pipelines) { base.ApplicationStartup(container, pipelines); /*enable lightningcache, vary by url params id,query,take and skip*/ this.EnableLightningCache(container.Resolve<IRouteResolver>(), ApplicationPipelines, new DefaultCacheKeyGenerator(new[] { "id", "query", "take", "skip" })); /*enable lightningcache using the DiskCacheStore, vary by url params id,query,take and skip*/ //this.EnableLightningCache(container.Resolve<IRouteResolver>(), ApplicationPipelines, new DefaultCacheKeyGenerator(new[] { "id", "query", "take", "skip" }), new DiskCacheStore("c:/tmp/cache")); }
protected override void ConfigureRequestContainer(Nancy.TinyIoc.TinyIoCContainer container, NancyContext context) { base.ConfigureRequestContainer(container, context); var docStore = container.Resolve<IDocumentStore>(); var docSession = docStore.OpenSession(); container.Register(docSession); context.Items.Add("RavenSession", docSession); }
protected override void RequestStartup(Nancy.TinyIoc.TinyIoCContainer container, Nancy.Bootstrapper.IPipelines pipelines, NancyContext context) { base.RequestStartup(container, pipelines, context); var formsAuthConfiguration = new FormsAuthenticationConfiguration() { RedirectUrl = "/login", //認証失敗時のリダイレクト先 UserMapper = container.Resolve<IUserMapper>() }; FormsAuthentication.Enable(pipelines, formsAuthConfiguration); //フォーム認証の有効化 }
protected override void ApplicationStartup(Nancy.TinyIoc.TinyIoCContainer container, Nancy.Bootstrapper.IPipelines pipelines) { base.ApplicationStartup(container, pipelines); pipelines.BeforeRequest += (ctx) => { var projectService = container.Resolve<IProjectService>(); ctx.ViewBag.Categories = projectService.GetCategories().ToArray(); return null; }; }
protected override void ApplicationStartup(Nancy.TinyIoc.TinyIoCContainer container, Nancy.Bootstrapper.IPipelines pipelines) { base.ApplicationStartup(container, pipelines); container.Register<ISettingsProvider, WebSettingsProvider>(); container.Register<ILoginProvider, LoginProvider>(); container.Register<ILandingProvider, LandingProvider>(); container.Register<IUserService, UserService>(); container.Register<IUserMapper>(container.Resolve<IUserService>()); }
protected override void RequestStartup(Nancy.TinyIoc.TinyIoCContainer container, Nancy.Bootstrapper.IPipelines pipelines, NancyContext context) { base.RequestStartup(container, pipelines, context); FormsAuthentication.Enable(pipelines, new FormsAuthenticationConfiguration() { RedirectUrl = "~/login", UserMapper = container.Resolve<IUserMapper>() }); CookieBasedSessions.Enable(pipelines); }
protected override void ApplicationStartup(Nancy.TinyIoc.TinyIoCContainer container, IPipelines pipelines) { base.ApplicationStartup(container, pipelines); JsConfig.EmitCamelCaseNames = true; JsConfig.DateHandler = JsonDateHandler.ISO8601; JsConfig.IncludeNullValues = false; var pathProvider = container.Resolve<IRootPathProvider>(); var travelRepoJsonPath = Path.Combine(pathProvider.GetRootPath(), "Resources", "offers.json"); var travelRepo = new TravelOffersRepository(travelRepoJsonPath); container.Register<ITravelOffersRepository>(travelRepo); }
protected override void ConfigureApplicationContainer(Nancy.TinyIoc.TinyIoCContainer container) { base.ConfigureApplicationContainer(container); container.Register(SqlServerConfiguration.ReadAppSettings()); var sqlExecutor = container.Resolve<SqlExecutor>(); container.Register(SqlSelectCourse.Load(sqlExecutor)); container.Register<ILogger>(Logger.CreateFromConfiguration()); var assembly = GetType().Assembly; if (!s_ViewSetupCompleted) { ResourceViewLocationProvider .RootNamespaces .Add(assembly, "RedGate.Publishing.InteractiveSql.Web.Views"); s_ViewSetupCompleted = true; } }
// The bootstrapper enables you to reconfigure the composition of the framework, // by overriding the various methods and properties. // For more information https://github.com/NancyFx/Nancy/wiki/Bootstrapper protected override void ApplicationStartup(Nancy.TinyIoc.TinyIoCContainer container, Nancy.Bootstrapper.IPipelines pipelines) { Conventions.ViewLocationConventions.Clear(); Conventions.ViewLocationConventions.Add((viewName, model, context) => { string viewLocation = string.Concat("Views/", viewName); if (context.ModulePath != null && context.ModulePath.StartsWith("/admin")) { viewLocation = string.Concat("Areas/Admin/Views/", viewName); } return viewLocation; }); base.ApplicationStartup(container, pipelines); //Nancy.ViewEngines.Razor.RazorViewEngine var engine = container.Resolve<Nancy.ViewEngines.Razor.RazorViewEngine>(); }
protected override void ApplicationStartup(Nancy.TinyIoc.TinyIoCContainer container, Nancy.Bootstrapper.IPipelines pipelines) { // Cache the settings from the config file in memory SettingsRequest.RetrieveSettings(); // Cache the brandings from the config file in memory BrandingsRequest.RetrieveBrandings(); // Enable cookie based sessions CookieBasedSessions.Enable(pipelines); base.ApplicationStartup(container, pipelines); var authenticationConfiguration = new FormsAuthenticationConfiguration { RedirectUrl = "~/login", UserMapper = container.Resolve<IUserMapper>(), }; FormsAuthentication.Enable(pipelines, authenticationConfiguration); }
protected override void ApplicationStartup(Nancy.TinyIoc.TinyIoCContainer container, IPipelines pipelines) { container.Resolve<InteractiveSqlApplication>().Start(); }
protected override void RequestStartup(Nancy.TinyIoc.TinyIoCContainer container, Nancy.Bootstrapper.IPipelines pipelines, NancyContext context) { base.RequestStartup(container, pipelines, context); TokenAuthentication.Enable(pipelines, new TokenAuthenticationConfiguration(container.Resolve<ITokenizer>())); }