public void Init() { //初始化配置文件 Assembly entryAssembly = Assembly.GetExecutingAssembly(); Configuration configuration = ConfigurationExtension.GetConfigurationFromAssembly(entryAssembly); FrameworkSection.Initialize(configuration); DependencyInjectionSection.Initialize(configuration); RedisSection.Initialize(configuration); if (!ResolveMediator.ContainerBuilt) { IServiceCollection builder = ResolveMediator.GetServiceCollection(); builder.RegisterConfigs(); ResolveMediator.Build(); } DbSession dbSession = new DbSession(); dbSession.Database.EnsureCreated(); this._unitOfWork = ResolveMediator.Resolve <IUnitOfWorkStub>(); GlobalSetting.InitCurrentSessionId(); }
/// <summary> /// 应用程序启动事件 /// </summary> protected void Application_Start() { //初始化配置文件 Configuration configuration = WebConfigurationManager.OpenWebConfiguration("~"); FrameworkSection.Initialize(configuration); //注册区域 AreaRegistration.RegisterAllAreas(); //注册路由 RouteTable.Routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); RouteTable.Routes.MapRoute( name: "Default", url: "{controller}/{action}/{id}", defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional } ); }
/// <summary> /// 配置应用程序 /// </summary> protected override void Configure() { //初始化配置文件 Assembly entryAssembly = Assembly.GetExecutingAssembly(); Configuration configuration = ConfigurationExtension.GetConfigurationFromAssembly(entryAssembly); ServiceModelSectionGroup.Initialize(configuration); FrameworkSection.Initialize(configuration); DependencyInjectionSection.Initialize(configuration); //初始化依赖注入容器 if (!ResolveMediator.ContainerBuilt) { IServiceCollection serviceCollection = ResolveMediator.GetServiceCollection(); serviceCollection.RegisterConfigs(); serviceCollection.RegisterServiceModels(); serviceCollection.RegisterNavigationService(); ResolveMediator.Build(); } //初始化消息组件 UserDialogs.Init(this); }
/// <summary> /// 应用程序启动事件 /// </summary> protected void Application_Start(object sender, EventArgs eventArgs) { Configuration configuration = WebConfigurationManager.OpenWebConfiguration("~"); FrameworkSection.Initialize(configuration); }