protected void Application_Start() { AreaRegistration.RegisterAllAreas(); RouteConfig.RegisterRoutes(RouteTable.Routes); BundleConfig.RegisterBundles(BundleTable.Bundles); // внедряем зависимости в проект NinjectModule registration = new NinjectRegistration(); var kernel = new StandardKernel(registration); kernel.Unbind <ModelValidatorProvider>(); DependencyResolver.SetResolver(new NinjectDependencyResolver(kernel)); // Присваиваем имя алгоритму шифрования EncryptionUtility.AlgorithmName = "DES"; var location = AppDomain.CurrentDomain.BaseDirectory; //Для выделения пути к каталогу воспользуемся `System.IO.Path`: EncryptionUtility.KeyFile = Path.GetDirectoryName(location) + "/key.config"; if (!File.Exists(EncryptionUtility.KeyFile)) { EncryptionUtility.GenerateKey(); } Database.SetInitializer <MusicPortalContext>(new DbInitializer()); using (MusicPortalContext context = new MusicPortalContext()) { context.Database.Initialize(false); } }
protected override IServiceProvider CreateContainer(IServiceProvider fallbackProvider) { IKernel kernel = new StandardKernel(); NinjectRegistration.Populate(kernel, TestServices.DefaultServices(), fallbackProvider); return(kernel.Get <IServiceProvider>()); }
protected void Application_Start() { AreaRegistration.RegisterAllAreas(); RouteConfig.RegisterRoutes(RouteTable.Routes); NinjectModule registration = new NinjectRegistration(); IKernel kernel = new StandardKernel(registration); DependencyResolver.SetResolver(new NinjectDependencyResolver(kernel)); }
protected void Application_Start() { AutoMapper.Mapper.Initialize(cfg => cfg.AddProfile <AutomapperConfiguration>()); GlobalConfiguration.Configure(WebApiConfig.Register); NinjectModule registration = new NinjectRegistration(); var kernel = new StandardKernel(registration); GlobalConfiguration.Configuration.DependencyResolver = new NinjectDependencyResolver(kernel); }
protected override void Configure() { var config = CreateConfig(Environment.GetCommandLineArgs()); var serviceCollection = CreateServiceCollection(config); NinjectRegistration.Populate(_container, serviceCollection); AugmentViewTypeLocator(ref ViewLocator.LocateTypeForModelType, FindProxy); base.Configure(); }
protected void Application_Start() { AreaRegistration.RegisterAllAreas(); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); RouteConfig.RegisterRoutes(RouteTable.Routes); BundleConfig.RegisterBundles(BundleTable.Bundles); NinjectModule module = new NinjectRegistration(); var kernel = new StandardKernel(module); DependencyResolver.SetResolver(new NinjectDependencyResolver(kernel)); }
protected void Application_Start() { AreaRegistration.RegisterAllAreas(); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); RouteConfig.RegisterRoutes(RouteTable.Routes); BundleConfig.RegisterBundles(BundleTable.Bundles); //Непосдрественная регистрация зависимостей NinjectModule registrations = new NinjectRegistration(); var kernel = new StandardKernel(registrations); DependencyResolver.SetResolver(new NinjectDependencyResolver(kernel)); }
protected void Application_Start() { //Database.SetInitializer(new Init()); AreaRegistration.RegisterAllAreas(); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); RouteConfig.RegisterRoutes(RouteTable.Routes); BundleConfig.RegisterBundles(BundleTable.Bundles); // внедрение зависимостей NinjectModule registrations = new NinjectRegistration(); var kernel = new StandardKernel(registrations); DependencyResolver.SetResolver(new NinjectDependencyResolver(kernel)); }
protected void Application_Start() { AreaRegistration.RegisterAllAreas(); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); RouteConfig.RegisterRoutes(RouteTable.Routes); BundleConfig.RegisterBundles(BundleTable.Bundles); NinjectModule registrations = new NinjectRegistration(); var kernel = new StandardKernel(registrations); DependencyResolver.SetResolver(new NinjectDependencyResolver(kernel)); Gnostice.PDFOne.Extensions.MVC.PDFViewer.ActivateLicense("7F31-B744-6AFD-6540-D4A9-C0D2-6103-D9A3"); }
protected void Application_Start() { ModelValidatorProviders.Providers.Clear(); AreaRegistration.RegisterAllAreas(); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); RouteConfig.RegisterRoutes(RouteTable.Routes); BundleConfig.RegisterBundles(BundleTable.Bundles); NinjectModule registrations = new NinjectRegistration("DefaultConnection"); var kernel = new StandardKernel(registrations); DependencyResolver.SetResolver(new NinjectDependencyResolver(kernel)); }
protected void Application_Start() { AreaRegistration.RegisterAllAreas(); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); RouteConfig.RegisterRoutes(RouteTable.Routes); BundleConfig.RegisterBundles(BundleTable.Bundles); NinjectModule registration = new NinjectRegistration(); var kernel = new StandardKernel(registration); DependencyResolver.SetResolver(new NinjectDependencyResolver(kernel)); Mapper.Initialize(cfg => cfg.CreateMap <Employee, EmployeeViewModel>()); ModelValidatorProviders.Providers.Remove( ModelValidatorProviders.Providers.OfType <DataAnnotationsModelValidatorProvider>().First()); }
protected void Application_Start() { AreaRegistration.RegisterAllAreas(); GlobalConfiguration.Configure(WebApiConfig.Register); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); RouteConfig.RegisterRoutes(RouteTable.Routes); BundleConfig.RegisterBundles(BundleTable.Bundles); #region Ninject NinjectModule registration = new NinjectRegistration(); var kernel = new StandardKernel(registration); var ninjectResolver = new NinjectDependencyResolver(kernel); DependencyResolver.SetResolver(ninjectResolver); GlobalConfiguration.Configuration.DependencyResolver = ninjectResolver; #endregion }
protected void Application_Start() { //Какая-то херня с Нинжектом, вылетает ошибка валидации некоторых полей, нашел в инете решение. ModelValidatorProviders.Providers.Clear(); AreaRegistration.RegisterAllAreas(); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); RouteConfig.RegisterRoutes(RouteTable.Routes); BundleConfig.RegisterBundles(BundleTable.Bundles); //Биндим корзину ModelBinders.Binders.Add(typeof(Cart), new CartModelBinder()); NinjectModule registrations = new NinjectRegistration("DefaultConnection"); var kernel = new StandardKernel(registrations); DependencyResolver.SetResolver(new NinjectDependencyResolver(kernel)); }
protected void Application_Start() { AreaRegistration.RegisterAllAreas(); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); RouteConfig.RegisterRoutes(RouteTable.Routes); BundleConfig.RegisterBundles(BundleTable.Bundles); ModelBinders.Binders .Add(typeof(Comparison <CPUViewModel>), new CompareCPUModelBinder()); ModelBinders.Binders .Add(typeof(Comparison <GPUViewModel>), new CompareGPUModelBinder()); //ControllerBuilder.Current.SetControllerFactory(new NinjectControllerFactory()); NinjectModule servicesModule = new AutoMapperNinjectModule(); NinjectModule presentationModule = new NinjectRegistration(); var kernel = new StandardKernel(servicesModule, presentationModule); kernel.Unbind <ModelValidatorProvider>(); DependencyResolver.SetResolver(new NinjectDependencyResolver(kernel)); }