当前位置: 首页>>代码示例>>C#>>正文


C# IKernel.BindFilter方法代码示例

本文整理汇总了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>();
        }
开发者ID:pleb,项目名称:Examples,代码行数:12,代码来源:NinjectMVC3.cs

示例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);
        }
开发者ID:pleb,项目名称:Examples,代码行数:12,代码来源:NinjectMVC3.cs

示例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);
        }
开发者ID:serakrin,项目名称:presentations,代码行数:13,代码来源:NinjectMVC3.cs

示例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);
 }
开发者ID:gerardo-flores,项目名称:Shell,代码行数:14,代码来源:NinjectMVC3.cs

示例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>();
 }
开发者ID:ibakyrdjiev,项目名称:ASP.NET-MVC,代码行数:14,代码来源:NinjectWebCommon.cs

示例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>();
        }
开发者ID:ryancole,项目名称:RepositoryExample,代码行数:16,代码来源:NinjectWebCommon.cs

示例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);
		}
开发者ID:GrayOsmose,项目名称:UserAdmin.Challenge,代码行数:18,代码来源:NinjectWebCommon.cs

示例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);
 }       
开发者ID:fe10tads,项目名称:curso-entityframework,代码行数:11,代码来源:NinjectWebCommon.cs

示例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);
        }
开发者ID:rubenskm,项目名称:Alura,代码行数:12,代码来源:NinjectWebCommon.cs

示例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>();
        }
开发者ID:ammeep,项目名称:giftme,代码行数:21,代码来源:NinjectActivation.cs

示例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);
 }
开发者ID:rexwhitten,项目名称:reportspace,代码行数:14,代码来源:NinjectWebCommon.cs

示例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);
        }
开发者ID:TrevorVonSeggern,项目名称:Dota-Betting-ELO,代码行数:20,代码来源:NinjectWebCommon.cs

示例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>());
        }        
开发者ID:grbbod,项目名称:drconnect-jungo,代码行数:18,代码来源:NinjectWebCommon.cs

示例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);
        }
开发者ID:BeczkaPGS,项目名称:ForGrzesiekToReview,代码行数:24,代码来源:NinjectWebCommon.cs

示例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();
        }
开发者ID:skyfighter007,项目名称:Britespokes-Dev,代码行数:49,代码来源:NinjectWebCommon.cs


注:本文中的IKernel.BindFilter方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。