protected override IKernel CreateKernel() { var kernel = new StandardKernel(); kernel.Bind <IConfig>().To <AppSettingsConfig>(); kernel.Bind <IFileSystem>().To <FileSystem>(); kernel.BindFilter <PathInitializationFilter>(FilterScope.Controller, 0) .WhenControllerHas <HasPathInputsAttribute>(); kernel.BindFilter <PathConvertingFilter>(FilterScope.Controller, 1) .WhenControllerHas <HasPathInputsAttribute>(); kernel.Bind <IModelBinder>().To <NullPathBinder>(); ModelBinders.Binders.DefaultBinder = kernel.Get <IModelBinder>(); return(kernel); }
/// <summary> /// Creates the kernel that will manage your application. /// </summary> /// <returns>The created kernel.</returns> private static Ninject.IKernel CreateKernel() { var kernel = new StandardKernel(new Services.Registrations.NHibernateModule()); kernel.Bind <Func <IKernel> >().ToMethod(ctx => () => new Bootstrapper().Kernel); kernel.Bind <IHttpModule>().To <HttpApplicationInitializationHttpModule>(); kernel.BindFilter <TransactionAttribute>(FilterScope.Action, 0).WhenActionMethodHas <TransactionAttribute>(); RegisterServices(kernel); return(kernel); }
/// <summary> /// Creates the kernel that will manage your application. /// </summary> /// <returns>The created kernel.</returns> protected override IKernel CreateKernel() { StandardKernel kernel = new StandardKernel(); kernel.Load(new ServiceModule()); kernel.Bind(x => x.FromAssembliesMatching("Telimena.*.dll").SelectAllClasses().Excluding(typeof(TelimenaUserManager)).BindDefaultInterface()); kernel.BindFilter <AuditFilter>(FilterScope.Action, null).WhenActionMethodHas <AuditAttribute>(); kernel.Bind <IAuditLogger>().To <DebugAuditLogger>(); GlobalConfiguration.Configuration.DependencyResolver = new NinjectDependencyResolver(kernel); Hangfire.GlobalConfiguration.Configuration.UseNinjectActivator(kernel); return(kernel); }
private static StandardKernel CreateKernel() { var kernel = new StandardKernel(new UnitOfWorkModule()); //Service register kernel.Bind <IUserService>().To <UserService>(); kernel.Bind <IDispatcherService>().To <DispatcherService>(); kernel.Bind <IDriverService>().To <DriverService>(); kernel.Bind <IAutoService>().To <AutoService>(); kernel.Bind <IFlightService>().To <FlightService>(); kernel.Bind <IFlightRequestService>().To <FlightRequestService>(); kernel.Bind <ILoggerService>().To <LogService>(); //Filter register kernel.BindFilter <ExceptionLoggerFilter>(FilterScope.Controller, 0) .WhenControllerHas <ExceptionLoggerAttribute>(); kernel.BindFilter <ActionLoggerFilter>(FilterScope.Controller, 0) .WhenControllerHas <ActionLoggerAttribute>(); return(kernel); }
protected override IKernel CreateKernel() { IKernel kernel = new StandardKernel(); kernel.Load(Assembly.GetExecutingAssembly()); BindDataAccessLayer(kernel); BindSecurityServices(kernel); BindLogic(kernel); BindLogger(kernel); kernel.BindFilter <AdministratorOnlyFilter>(FilterScope.Action, 0) .WhenActionMethodHas <AdministratorOnlyAttribute>(); return(kernel); }