示例#1
0
        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            //BundleConfig.RegisterBundles(BundleTable.Bundles);

            BundleManager.Config();

            //MVC控制器工厂添加IOC容器
            var container = GetContainer();

            ControllerBuilder.Current.SetControllerFactory(new ControllerFactory(container));

            //easyui验证绑定
            SettingsBindManager.RegisterBinder("validatebox", new ValidateBoxSettingBinder());
            SettingsBindManager.RegisterBinder("numberbox", new NumberBoxSettingBinder());

            //使用 LightEntity 反序列化转换器
            GlobalSetting.Converters.Add(new LightEntityJsonConverter());

            //从 Container 里反转类型反序列化
            GlobalSetting.Converters.Add(new ContainerJsonConverter(container));

            //注册实体持久化的订阅通知
            SubscribeManager.Register <EntityPersistentSubject>(new EntitySubscriber());
        }
示例#2
0
        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            //BundleConfig.RegisterBundles(BundleTable.Bundles);

            BundleManager.Config();

            //MVC控制器工厂添加IOC容器
            var container = ContainerUnity.GetContainer();

            ControllerBuilder.Current.SetControllerFactory(new ControllerFactory(container));

            //注入所有控制器
            container.RegisterControllers(Assembly.GetExecutingAssembly());

            //注入DbContext
            container.Register <DbContext>(Lifetime.Scoped);

            //easyui验证绑定
            SettingsBindManager.RegisterBinder("validatebox", new ValidateBoxSettingBinder());
            SettingsBindManager.RegisterBinder("numberbox", new NumberBoxSettingBinder());

            //使用 LightEntity 反序列化转换器
            GlobalSetting.Converters.Add(new LightEntityJsonConverter());

            //从 Container 里反转类型反序列化
            GlobalSetting.Converters.Add(new ContainerJsonConverter(container));

            //注册实体持久化的订阅通知
            //DefaultSubscribeManager.Instance.AddSubscriber<PersistentSubject>(subject => new EntitySubscriber().Accept(subject));

            MapperUnity.AddProfile <AutoProfile>();
        }
        /// <summary>
        /// 配置 EasyUI 的相关扩展。
        /// </summary>
        /// <param name="builder"></param>
        /// <param name="action"></param>
        /// <returns></returns>
        public static IMvcBuilder ConfigureEasyUI(this IMvcBuilder builder, Action <EasyUIOptions> setupAction = null)
        {
            SettingsBindManager.RegisterBinder("validatebox", new ValidateBoxSettingBinder());
            SettingsBindManager.RegisterBinder("numberbox", new NumberBoxSettingBinder());

            var options = new EasyUIOptions();

            if (setupAction != null)
            {
                setupAction(options);

                foreach (var binder in options.binders)
                {
                    SettingsBindManager.RegisterBinder(binder.Key, binder.Value);
                }
            }

            return(builder);
        }
示例#4
0
        protected void Application_Start()
        {
            //配置 bundler
            BundleHelper.Config();

            AreaRegistration.RegisterAllAreas();

            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);
            AuthConfig.RegisterAuth();

            //easyui验证绑定
            SettingsBindManager.RegisterBinder("validatebox", new ValidateBoxSettingBinder());
            SettingsBindManager.RegisterBinder("numberbox", new NumberBoxSettingBinder());

            //IOC容器测试
            var container = ContainerUnity.GetContainer();

            container.Register <IMessageTest, MessageTest>();

            //MVC控制器工厂添加IOC容器
            ControllerBuilder.Current.SetControllerFactory(new Fireasy.Web.Mvc.ControllerFactory(container));
        }