public override void PreInitialize() { //Enable database based localization //Configuration.Modules.Zero().LanguageManagement.EnableDbLocalization(); Configuration.BackgroundJobs.IsJobExecutionEnabled = false; //Configure navigation/menu Configuration.Navigation.Providers.Add <BlocksNavigationProvider>(); IocManager.Register <RouteCollection>(RouteTable.Routes); var a = WebHostingEnvironment.CreateHostingEnvironment(new WebHostingEnvironment() { ContentRootPath = HostingEnvironment.ApplicationPhysicalPath }); IocManager.Register <IHostingEnvironment>(a); i //RouteTable.Routes.RouteExistingFiles = true; Configuration.Settings.Providers.Add <GlobalSettingProvider>(); //Configure Hangfire - ENABLE TO USE HANGFIRE INSTEAD OF DEFAULT JOB MANAGER //Configuration.BackgroundJobs.UseHangfire(configuration => //{ // configuration.GlobalConfiguration.UseSqlServerStorage("Default"); //}); }
public override void PreInitialize() { var _currentRootPath = Directory.GetCurrentDirectory(); var currentHostingEnvironment = WebHostingEnvironment.CreateHostingEnvironment(new WebHostingEnvironment() { ContentRootPath = _currentRootPath }); var _defaultVirtualPathProvider = new DefaultVirtualPathProvider(currentHostingEnvironment); IocManager.Register <IWebSiteFolder, WebSiteFolder>( (Kernel, ComponentModel, CreationContext) => { return(new WebSiteFolder(null, _defaultVirtualPathProvider)); }, DependencyLifeStyle.Singleton); IocManager.Register <ExtensionDescriptor, ExtensionDescriptor>( (Kernel, ComponentModel, CreationContext) => { return(new ExtensionDescriptor() { Name = "TestNavigationModule" }); }, DependencyLifeStyle.Singleton); IocManager.Register <Localizer, Localizer>( (Kernel, ComponentModel, CreationContext) => { return((text, param) => new LocalizableString("TestNavigationModule", text, param)); }, DependencyLifeStyle.Singleton); }
public override void PreInitialize() { Configuration.Settings.Providers.Add <GlobalSettingProvider>(); var a = WebHostingEnvironment.CreateHostingEnvironment(new WebHostingEnvironment() { ContentRootPath = AppDomain.CurrentDomain.BaseDirectory //HostingEnvironment.ApplicationPhysicalPath }); IocManager.Register <IHostingEnvironment>(a); PerWebRequestLifestyleModule.FuncHttpCache = (noInput) => { return(new Dictionary <object, object>()); }; //TODO unit test can't read config from appconfig. // var testUserContext = new Mock<ClaimsPrincipal>(); // testUserContext.Setup(u => u.Claims) // .Returns(new List<Claim>{ new Claim(AbpClaimTypes.UserId,"testId"),new Claim(AbpClaimTypes.UserName,"testName") }); Thread.CurrentPrincipal = new ClaimsPrincipal(new List <ClaimsIdentity> { new ClaimsIdentity(new List <Claim>() { new Claim(AbpClaimTypes.UserId, "testId"), new Claim(AbpClaimTypes.UserName, "testName") }) }) { }; }
public DefaultVirtualPathProviderTest() { var currentHostingEnvironment = WebHostingEnvironment.CreateHostingEnvironment(new WebHostingEnvironment() { ContentRootPath = Directory.GetCurrentDirectory() }); _defaultVirtualPathProvider = new DefaultVirtualPathProvider(currentHostingEnvironment); }
public DefaultVirtualPathMonitorTest() { _currentRootPath = Directory.GetCurrentDirectory(); var currentHostingEnvironment = WebHostingEnvironment.CreateHostingEnvironment(new WebHostingEnvironment() { ContentRootPath = _currentRootPath }); _patchMonitor = new DefaultVirtualPathMonitor(new Clock(), new DefaultVirtualPathProvider(currentHostingEnvironment)); fileName = Guid.NewGuid().ToString(); }
public override void PreInitialize() { Configuration.Settings.Providers.Add <GlobalSettingProvider>(); var a = WebHostingEnvironment.CreateHostingEnvironment(new WebHostingEnvironment() { ContentRootPath = AppDomain.CurrentDomain.BaseDirectory //HostingEnvironment.ApplicationPhysicalPath }); IocManager.Register <IHostingEnvironment>(a); //TODO unit test can't read config from appconfig. }
protected virtual void Application_Start(object sender, EventArgs e) { var stopwatch = new Stopwatch(); stopwatch.Start(); PerWebRequestLifestyleModule.FuncHttpCache = (noInput) => { return(HttpContext.Current.Items); }; AbpBootstrapper.IocManager.IocContainer.AddFacility <Castle.Facilities.Logging.LoggingFacility>( f => Blocks.Framework.Logging.Log4Net.LoggingFacilityExtensions.UseLog4Net(f).WithConfig(Server.MapPath(logConfigName)) ); ThreadCultureSanitizer.Sanitize(); var environment = WebHostingEnvironment.CreateHostingEnvironment(new WebHostingEnvironment() { ContentRootPath = Server.MapPath("~") }); IVirtualPathProvider pathProvider = new DefaultVirtualPathProvider(environment); if (pathProvider.DirectoryExists(@"~\Modules")) { foreach (var modulePath in pathProvider.ListDirectories(@"~\Modules")) { var moduleFileList = pathProvider.ListDirectories(modulePath); // if (!moduleFileList.Any(t => string.Equals(t, "Module.txt", StringComparison.CurrentCultureIgnoreCase))) // continue; var moduleBin = moduleFileList.FirstOrDefault(t => t.EndsWith("bin")); moduleBin = moduleBin ?? moduleFileList.FirstOrDefault(t => t.EndsWith("Release")); if (!string.IsNullOrEmpty(moduleBin)) { AbpBootstrapper.PlugInSources.AddFolder(pathProvider.MapPath(moduleBin), SearchOption.AllDirectories); } } } AbpBootstrapper.Initialize(); stopwatch.Stop(); LogHelper.Log(new LogModel() { Message = "Framework Init time:" + stopwatch.ElapsedMilliseconds + "ms", LogSeverity = LogSeverity.Info }); }
public override void PreInitialize() { Configuration.Settings.Providers.Add <GlobalSettingProvider>(); var a = WebHostingEnvironment.CreateHostingEnvironment(new WebHostingEnvironment() { ContentRootPath = AppDomain.CurrentDomain.BaseDirectory //HostingEnvironment.ApplicationPhysicalPath }); IocManager.Register <IHostingEnvironment>(a); Thread.CurrentPrincipal = new ClaimsPrincipal(new List <ClaimsIdentity> { new ClaimsIdentity(new List <Claim>() { new Claim(AbpClaimTypes.UserId, "testId"), new Claim(AbpClaimTypes.UserName, "testName") }) }) { }; }
protected virtual void Application_Start(object sender, EventArgs e) { AbpBootstrapper.IocManager.IocContainer.AddFacility <LoggingFacility>( f => f.UseAbpLog4Net().WithConfig(Server.MapPath(logConfigName)) ); ThreadCultureSanitizer.Sanitize(); var environment = WebHostingEnvironment.CreateHostingEnvironment(new WebHostingEnvironment() { ContentRootPath = Server.MapPath("~") }); IVirtualPathProvider pathProvider = new DefaultVirtualPathProvider(environment); if (pathProvider.DirectoryExists(@"~\Modules")) { AbpBootstrapper.PlugInSources.AddFolder(pathProvider.MapPath(@"~\Modules"), SearchOption.AllDirectories); } AbpBootstrapper.Initialize(); PerWebRequestLifestyleModule.FuncHttpCache = (noInput) => { return(HttpContext.Current.Items); }; }