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 DefaultVirtualPathProviderTest() { var currentHostingEnvironment = WebHostingEnvironment.CreateHostingEnvironment(new WebHostingEnvironment() { ContentRootPath = Directory.GetCurrentDirectory() }); _defaultVirtualPathProvider = new DefaultVirtualPathProvider(currentHostingEnvironment); }
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 }); }
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); }; }