本文整理汇总了C#中Nancy.Resolve方法的典型用法代码示例。如果您正苦于以下问题:C# Nancy.Resolve方法的具体用法?C# Nancy.Resolve怎么用?C# Nancy.Resolve使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Nancy
的用法示例。
在下文中一共展示了Nancy.Resolve方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RequestStartup
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());
}
示例2: ApplicationStartup
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"));
}
示例3: ConfigureRequestContainer
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);
}
示例4: RequestStartup
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); //フォーム認証の有効化
}
示例5: ApplicationStartup
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;
};
}
示例6: ApplicationStartup
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>());
}
示例7: RequestStartup
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);
}
示例8: ApplicationStartup
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);
}
示例9: ConfigureApplicationContainer
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;
}
}
示例10: ApplicationStartup
// 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>();
}
示例11: ApplicationStartup
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);
}
示例12: ApplicationStartup
protected override void ApplicationStartup(Nancy.TinyIoc.TinyIoCContainer container, IPipelines pipelines)
{
container.Resolve<InteractiveSqlApplication>().Start();
}
示例13: RequestStartup
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>()));
}