本文整理汇总了C#中IKernel.BindFilter方法的典型用法代码示例。如果您正苦于以下问题:C# IKernel.BindFilter方法的具体用法?C# IKernel.BindFilter怎么用?C# IKernel.BindFilter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IKernel
的用法示例。
在下文中一共展示了IKernel.BindFilter方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RegisterServices
/// <summary>
/// Load your modules or register your services here!
/// </summary>
/// <param name="kernel">The kernel.</param>
private static void RegisterServices(IKernel kernel)
{
kernel.BindFilter<LocalOnlyRequestFilter>(FilterScope.Controller, 0)
.WhenControllerHas<LocalOnlyRequestAttribute>();
kernel.BindFilter<LocalOnlyRequestFilter>(FilterScope.Action, 0)
.WhenActionMethodHas<LocalOnlyRequestAttribute>();
}
示例2: RegisterServices
/// <summary>
/// Load your modules or register your services here!
/// </summary>
/// <param name="kernel">The kernel.</param>
private static void RegisterServices(IKernel kernel)
{
kernel.BindFilter<FilterAlpha>(FilterScope.Controller, 0)
.WhenControllerHas<AlphaAttribute>();
//kernel.BindFilter<FilterAlpha>(FilterScope.Global, 0);
kernel.BindFilter<FilterBeta>(FilterScope.Global, 0);
}
示例3: RegisterServices
/// <summary>
/// Load your modules or register your services here!
/// </summary>
/// <param name="kernel">The kernel.</param>
private static void RegisterServices(IKernel kernel)
{
kernel.Bind<Database>()
.ToMethod(c => new PetaPoco.Database("GrokMob"))
.InRequestScope();
kernel.BindFilter<StatsViewDataAttribute>(FilterScope.Global, 0);
kernel.BindFilter<UserViewDataAttribute>(FilterScope.Global, 0);
}
示例4: RegisterServices
/// <summary>
/// Load your modules or register your services here!
/// </summary>
/// <param name="kernel">The kernel.</param>
private static void RegisterServices(IKernel kernel)
{
kernel.Bind<ILogger>().To<NLogger>().InSingletonScope();
kernel.Bind<IIdStore>().To<FormsAuthIdStore>();
kernel.Bind<IBackgroundJobManager>().To<BackgroundJobManager>().InSingletonScope();
kernel.Bind<ISchedulerFactory>().To<StdSchedulerFactory>().InSingletonScope();
kernel.Bind<IScheduler>().ToMethod(context => context.Kernel.Get<ISchedulerFactory>().GetScheduler()).InSingletonScope();
kernel.BindFilter<VerifyClickThruAttribute>(FilterScope.Controller, 0);
kernel.BindFilter<ForcePasswordChangeAttribute>(FilterScope.Controller, 1);
}
示例5: RegisterServices
/// <summary>
/// Load your modules or register your services here!
/// </summary>
/// <param name="kernel">The kernel.</param>
private static void RegisterServices(IKernel kernel)
{
kernel.Bind<ICarData>().To<CarData>();
kernel.Bind<ICarDbContext>().To<CarDbContext>();
kernel.Bind<ICacheService>().To<CarsCacheService>();
kernel.BindFilter<CheckIsAllowedForEditingCar>(FilterScope.Controller, int.MaxValue)
.WhenControllerHas<CheckIsAllowedForEditingCar>();
kernel.BindFilter<CheckIsAllowedForEditingCar>(FilterScope.Action, int.MaxValue)
.WhenControllerHas<CheckIsAllowedForEditingCar>();
}
示例6: RegisterServices
/// <summary>
/// Load your modules or register your services here!
/// </summary>
/// <param name="kernel">The kernel.</param>
private static void RegisterServices(IKernel kernel)
{
// service interfaces
kernel.Bind<IWarcraftSession>()
.To<WarcraftSession>()
.InRequestScope();
// filter bindings
kernel.BindFilter<IsAdminFilter>(FilterScope.Action, 0);
kernel.BindFilter<AuthorizeAdminFilter>(FilterScope.Action, 0)
.WhenActionMethodHas<AuthorizeAdminAttribute>();
}
示例7: RegisterServices
/// <summary>
/// Load your modules or register your services here!
/// </summary>
/// <param name="kernel">The kernel.</param>
private static void RegisterServices(IKernel kernel)
{
kernel.BindFilter<AuthorizeFilter>(FilterScope.Controller, 0)
.WhenControllerHas<YmirAuthorizeAttribute>()
.WithConstructorArgumentFromControllerAttribute<YmirAuthorizeAttribute>("requiredPermissions", attribute => attribute.RequiredAccess);
kernel.BindFilter<AuthorizeFilter>(FilterScope.Controller, 0)
.WhenActionMethodHas<YmirAuthorizeAttribute>()
.WithConstructorArgumentFromActionAttribute<YmirAuthorizeAttribute>("requiredPermissions", attribute => attribute.RequiredAccess);
kernel.Bind<IAuthenticationService>().To<AuthenticationService>().InRequestScope();
// kernel.Bind<IClientService>().To<ClientService>().InRequestScope();
Debug(kernel);
}
示例8: RegisterServices
/// <summary>
/// Load your modules or register your services here!
/// </summary>
/// <param name="kernel">The kernel.</param>
private static void RegisterServices(IKernel kernel)
{
kernel.Bind<EntidadesContext>().ToSelf().InRequestScope();
// registro dos outros componentes
int ordemExecucao = 1;
kernel.BindFilter<SaveChangesFilter>(FilterScope.Global, ordemExecucao);
}
示例9: RegisterServices
/// <summary>
/// Load your modules or register your services here!
/// </summary>
/// <param name="kernel">The kernel.</param>
private static void RegisterServices(IKernel kernel)
{
kernel.Bind<ISession>().ToMethod(x => NHibernateHelper.AbreSession()).InRequestScope();
// registro dos outros componentes
int ordemExecucao = 1;
kernel.BindFilter<TransactionFilter>(FilterScope.Global, ordemExecucao);
}
示例10: RegisterServices
/// <summary>
/// Load your modules or register your services here!
/// </summary>
/// <param name="kernel">The kernel.</param>
private static void RegisterServices(IKernel kernel)
{
kernel.Bind<IConfiguration>().To<Configuration>();
kernel.Bind<ILoggingService>().To<LoggingService>();
kernel.Bind<IAuthenticationService>().To<AuthenticationService>();
kernel.Bind<ICurrentUser>().To<CurrentUser>();
kernel.Bind<IGiftRepository>().To<GiftRepository>();
kernel.Bind<IFeedbackRepository>().To<FeedbackRepository>();
kernel.Bind<IUserRepository>().To<UserRepository>();
kernel.Bind<IUserManager>().To<UserManager>();
kernel.Bind<IRegistryManager>().To<RegistryManager>();
kernel.Bind<IMailService>().To<MailService>();
kernel.Bind<IFeedbackManager>().To<FeedbackManager>();
kernel.BindFilter<HandleAllTheThingsAttribute>(System.Web.Mvc.FilterScope.Controller, 0);
kernel.BindFilter<AuthorizeAdminUserFilter>(FilterScope.Action, 0).WhenActionMethodHas<AuthorizeAdminUserAttribute>();
}
示例11: RegisterServices
/// <summary>
/// Load your modules or register your services here!
/// </summary>
/// <param name="kernel">The kernel.</param>
private static void RegisterServices(IKernel kernel)
{
kernel.Bind<IReportsService>().To<ReportsService>();
kernel.Bind<IReportParametersService>().To<ReportParameterService>();
kernel.Bind<IRoleService>().To<RoleService>();
kernel.Bind<IReportParameterFactory>().To<ReportParameterFactory>();
kernel.Bind<IReportsContext>().To<ReportsContext>().InRequestScope();
kernel.Bind<IUserContext>().To<UsersContext>().InRequestScope();
kernel.BindFilter<SetUserLogo>(FilterScope.Controller, 0);
}
示例12: RegisterFilters
private static void RegisterFilters(IKernel kernel)
{
kernel.BindFilter<AuthorizationFilter>(System.Web.Mvc.FilterScope.Controller, 0)
.WhenControllerHas<CustomAuthorize>()
.WithConstructorArgumentFromControllerAttribute<CustomAuthorize>(
"requiredRight",
attribute => attribute.RequiredRight)
.WithConstructorArgumentFromControllerAttribute<CustomAuthorize>(
"requiredRightOperations",
attribute => attribute.RequiredRightOperations);
kernel.BindFilter<AuthorizationFilter>(System.Web.Mvc.FilterScope.Action, 0)
.WhenActionMethodHas<CustomAuthorize>()
.WithConstructorArgumentFromActionAttribute<CustomAuthorize>(
"requiredRight",
attribute => attribute.RequiredRight)
.WithConstructorArgumentFromActionAttribute<CustomAuthorize>(
"requiredRightOperations",
attribute => attribute.RequiredRightOperations);
}
示例13: RegisterServices
/// <summary>
/// Load your modules or register your services here!
/// </summary>
/// <param name="kernel">The kernel.</param>
private static void RegisterServices(IKernel kernel)
{
var modules = new List<NinjectModule>
{
new MvcModule()
};
kernel.Load(modules);
kernel.BindFilter<ErrorLoggingAttribute>(FilterScope.Global, 1);
//kernel.BindFilter<ValidateN2ShopperProfileAttribute>(FilterScope.Global, 4);
DependencyResolver.Register(
kernel.Get<IDependencyResolver>());
}
示例14: RegisterServices
private static void RegisterServices(IKernel kernel)
{
kernel.Bind<AppContext>().ToSelf().InRequestScope();
kernel.Bind<IUnitOfWork>().To<UnitOfWork>().InRequestScope();
kernel.BindFilter<StatusActionFilter>(System.Web.Mvc.FilterScope.Controller, 0).WhenControllerHas<StatusActionAttribute>();
kernel.BindFilter<RolesActionFilter>(System.Web.Mvc.FilterScope.Controller, 0).WhenControllerHas<RolesActionAttribute>();
kernel.BindFilter<PlanListActionFilter>(System.Web.Mvc.FilterScope.Controller, 0).WhenControllerHas<PlanListAttribute>();
kernel.BindFilter<PartnerActionFilter>(System.Web.Mvc.FilterScope.Controller, 0).WhenControllerHas<PartnerAttribute>();
kernel.BindFilter<HostedOrganisationActionFilter>(System.Web.Mvc.FilterScope.Controller, 0).WhenControllerHas<HostedOrganisationAttribute>();
kernel.BindFilter<AccountActionFilter>(System.Web.Mvc.FilterScope.Controller, 0).WhenControllerHas<AccountAttribute>();
kernel.BindFilter<ADUserActionFilter>(System.Web.Mvc.FilterScope.Controller, 0).WhenControllerHas<ADUserActionAttribute>();
kernel.Bind(x => { x.From(typeof(UserManagerService).Assembly).SelectAllClasses().EndingWith("Service").BindDefaultInterface(); });
kernel.Bind(typeof (IAdUserService)).To(typeof (AdUserSevice));
kernel.Bind(typeof(IUserStore<AppIdentityUser>)).To(typeof(UserStore<AppIdentityUser>)).WithConstructorArgument("context", kernel.Get<AppContext>());
kernel.Bind(typeof(UserManager<AppIdentityUser>)).To(typeof(UserManager<AppIdentityUser>)).WithConstructorArgument("store", kernel.Get<IUserStore<AppIdentityUser>>());
kernel.Bind(typeof(IRoleStore<IdentityRole, string>)).To(typeof(RoleStore<IdentityRole>)).WithConstructorArgument("context", kernel.Get<AppContext>());
kernel.Bind(typeof(RoleManager<IdentityRole>)).To(typeof(RoleManager<IdentityRole>)).WithConstructorArgument("store", kernel.Get<IRoleStore<IdentityRole, string>>());
kernel.Bind<IAuthenticationManager>().ToMethod(c => HttpContext.Current.GetOwinContext().Authentication);
}
示例15: RegisterServices
/// <summary>
/// Load your modules or register your services here!
/// </summary>
/// <param name="kernel">The kernel.</param>
private static void RegisterServices(IKernel kernel)
{
// logging
kernel.Bind<ILogger>().To<NLogLogger>().InSingletonScope();
// context
kernel.Bind<EfDbContext>().To<EfDbContext>().InRequestScope();
// filters
kernel.BindFilter<OrganizationAuthorize>(FilterScope.Controller, 0);
kernel.BindFilter<ConfirmationRequired>(FilterScope.Controller, null);
kernel.BindFilter<GuestRequired>(FilterScope.Controller, null);
kernel.BindFilter<LogUserActivityAttribute>(FilterScope.Controller, null);
// convention based binding
kernel.Bind(
x => x.FromAssembliesMatching("Britespokes.Services.dll", "Britespokes.Data.dll", "Britespokes.Web.dll")
.SelectAllClasses().BindDefaultInterface());
kernel.Bind(
x =>
x.FromAssembliesMatching("Britespokes.Data.dll")
.SelectAllClasses()
.InheritedFrom(typeof (IRepository<>))
.BindAllInterfaces());
// mailers
kernel.Bind<OrderNotificationMailerController>().To<OrderNotificationMailerController>()
.InRequestScope()
.WithConstructorArgument("orderNotificationEmailAddress", EnvironmentConfig.OrderNotificationEmailAddress);
kernel.Bind<GiftOrderNotificationMailerController>().To<GiftOrderNotificationMailerController>()
.InRequestScope()
.WithConstructorArgument("giftorderNotificationEmailAddress", EnvironmentConfig.GiftOrderNotificationEmailAddress);
kernel.Bind<StudentInquiryMailerController>().To<StudentInquiryMailerController>()
.InRequestScope()
.WithConstructorArgument("studentInquiryNotificationEmailAddress", EnvironmentConfig.StudentInquiryNotificationEmailAddress);
// services
kernel.Bind<IAuthenticationService>().To<FormsAuthenticationService>().InRequestScope();
// uploaders
kernel.Bind<IImageUploader>().To<AzureImageUploader>().InRequestScope();
}