Beispiel #1
0
        protected void Application_Start()
        {
            //Kendo
            AreaRegistration.RegisterAllAreas();
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            //BundleConfig.RegisterBundles(BundleTable.Bundles);

            Thread.CurrentThread.CurrentUICulture = new CultureInfo("ru-RU");

            //Decimal problem resolve
            //            ModelBinders.Binders.Add(typeof(decimal), new DecimalModelBinder());
            //ModelBinders.Binders.Add(typeof(decimal?), new DecimalModelBinder());

            // Ninject - IoC initialization
            _appController = new ApplicationController();
            _appController.RegisterConstant(_appController);

            // register DalDapperLib library
            DalDapperLib.Initialize(_appController, ConfigurationManager.ConnectionStrings["DefaultConnectionString"].ConnectionString);

            // log4net
            var configFile = new FileInfo(Server.MapPath("~/Web.config"));

            log4net.Config.XmlConfigurator.Configure(configFile);
            LogService.Current = new Log4NetLogger(LogManager.GetLogger(typeof(MvcApplication)));
            ModelBinders.Binders.DefaultBinder = new TrimModelBinder();
            LogService.QueryLog = new QueryWriteService(_appController);
            // Controller Factory initialization
            ControllerBuilder.Current.SetControllerFactory(
                new NinjectControllerFactory(_appController));

            _appController.RegisterConstant(LogService.Current);

            ClientDataTypeModelValidatorProvider.ResourceClassKey = "MyResources";
            DefaultModelBinder.ResourceClassKey = "MyResources";
        }