Esempio n. 1
0
        public override void RegisterSrevice(IContainerAdapter container)
        {
            container.RegisterAsPerRequest<IUnitOfWork>(x => new DbProvider("Conn_Crawl_db"));

            //注册Provider
            container.RegisterAsPerRequest<IConfigProvider>(x => new SqlSettingsProvider("Conn_Crawl_db"));

            container
                .RegisterAsSingleton<IFormsAuthenticationService,DefaultFormsAuthentication>()
                .RegisterAsSingleton<IMsgService, MsgService>();

            EventConfig.Configure(config =>
            {
                config.UsingUnitOfWorkFactory(container.Resolve<IUnitOfWork>);
                config.UsingDefaultEventDispatcher(typeof(Core.Entity).Assembly);
            });

            log4net.Config.XmlConfigurator.Configure(new System.IO.FileInfo(Server.MapPath("~/log4net.config")));
            Log.SetLog(LogManager.GetLogger("Loger"));
        }
Esempio n. 2
0
        public override void RegisterSrevice(IContainerAdapter container)
        {
            container.RegisterAsPerRequest<IUnitOfWork>(x => new DbProvider("conn_MicroWish_db"));

            //注册Provider
            container.RegisterAsPerRequest<IConfigProvider>(x => new SqlSettingsProvider("conn_MicroWish_db"));

            container.RegisterAsSingleton<IFormsAuthenticationService, DefaultFormsAuthentication>()
                .RegisterAsSingleton<IMsgService, MsgService>()
                .RegisterAsSingleton<IConfigService, ConfigService>()
                //.RegisterAsSingleton<IPaymentService, PaymentService>()
                .RegisterAsSingleton<IAdminService, AdminService>()
                //.RegisterAsSingleton<IProjectService, ProjectService>()
                //.RegisterAsSingleton<IDealService, DealService>()
                //.RegisterAsSingleton<IProjectTypeService, ProjectTypeService>()
                .RegisterAsSingleton<IAdminLogService, AdminLogService>();
                //.RegisterAsSingleton<IOrderService, OrderService>()
                //.RegisterAsSingleton<IAssignmentService, AssignmentService>()
                //.RegisterAsSingleton<IQureyService, QureyService>();

            //注册领域事件服务
            EventConfig.Configure(config =>
            {
                config.UsingUnitOfWorkFactory(container.Resolve<IUnitOfWork>);
                config.UsingDefaultEventDispatcher(typeof(LoveBank.Core.Entity).Assembly);
            });

            //配置基于MVC的相关配置
            LoveBankMvcConfig.Configure(config =>
                                       {
                                            config.SiteMap(maps => maps.Register<XmlSiteMap>("default", x => x.Load()));
                                            config.Sercurity(typeof (MvcApplication).Assembly,x=>x.RegisterService<AdminService>());
                                            log4net.Config.XmlConfigurator.Configure(new System.IO.FileInfo(Server.MapPath("~/log4net.config")));
                                            Log.SetLog(LogManager.GetLogger("Loger"));
                                       }
                );
        }