/// <summary> /// This method is called by ASP.NET system on web application's startup. /// </summary> protected virtual void Application_Start(object sender, EventArgs e) { ThreadCultureSanitizer.Sanitize(); AbpBootstrapper.IocManager.RegisterIfNot <IAssemblyFinder, WebAssemblyFinder>(); AbpBootstrapper.Initialize(); }
public static void UseStudioX(this IAppBuilder app, [CanBeNull] Action <StudioXOwinOptions> optionsAction) { ThreadCultureSanitizer.Sanitize(); var options = new StudioXOwinOptions { UseEmbeddedFiles = HttpContext.Current?.Server != null }; optionsAction?.Invoke(options); if (options.UseEmbeddedFiles) { if (HttpContext.Current?.Server == null) { throw new StudioXInitializationException(@"Can not enable UseEmbeddedFiles for OWIN since HttpContext.Current is null! If you are using ASP.NET Core, serve embedded resources through ASP.NET Core middleware instead of OWIN."); } app.UseStaticFiles(new StaticFileOptions { FileSystem = new StudioXOwinEmbeddedResourceFileSystem( IocManager.Instance.Resolve <IEmbeddedResourceManager>(), IocManager.Instance.Resolve <IWebEmbeddedResourcesConfiguration>(), HttpContext.Current.Server.MapPath("~/") ) }); } }
public static void UseBlocks(this IAppBuilder app, Action <BlocksOwinOptions> optionsAction) { ThreadCultureSanitizer.Sanitize(); var options = new BlocksOwinOptions { UseEmbeddedFiles = HttpContext.Current?.Server != null }; optionsAction?.Invoke(options); if (options.UseEmbeddedFiles) { if (HttpContext.Current?.Server == null) { throw new AbpInitializationException("Can not enable UseEmbeddedFiles for OWIN since HttpContext.Current is null! If you are using ASP.NET Core, serve embedded resources through ASP.NET Core middleware instead of OWIN. See http://www.aspnetboilerplate.com/Pages/Documents/Embedded-Resource-Files#aspnet-core-configuration"); } app.UseStaticFiles(new StaticFileOptions { FileSystem = new Blocks.Owin.EmbeddedResources.BlocksOwinEmbeddedResourceFileSystem( IocManager.Instance.Resolve <IEmbeddedResourceManager>(), IocManager.Instance.Resolve <IWebEmbeddedResourcesConfiguration>(), HttpContext.Current.Server.MapPath("~/") ) }); } }
/// <summary> /// This method is called by ASP.NET system on web application's startup. /// 在web应用程序启动时,通过ASP.NET系统调用此方法 /// </summary> protected virtual void Application_Start(object sender, EventArgs e) { ThreadCultureSanitizer.Sanitize(); AbpBootstrapper.Initialize(); _webLocalizationConfiguration = AbpBootstrapper.IocManager.Resolve <IAbpWebLocalizationConfiguration>(); }
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 static void UseAbp(this IAppBuilder app, [CanBeNull] Action <AbpOwinOptions> optionsAction) { ThreadCultureSanitizer.Sanitize(); var options = new AbpOwinOptions(); optionsAction?.Invoke(options); if (options.UseEmbeddedFiles) { app.UseStaticFiles(new StaticFileOptions { FileSystem = new AbpOwinEmbeddedResourceFileSystem( IocManager.Instance.Resolve <IEmbeddedResourceManager>(), IocManager.Instance.Resolve <IWebEmbeddedResourcesConfiguration>() ) }); } }
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); }; }
/// <summary> /// This method is called by ASP.NET system on web application's startup. /// </summary> protected virtual void Application_Start(object sender, EventArgs e) { ThreadCultureSanitizer.Sanitize(); AbpBootstrapper.Initialize(); }
protected virtual void InitializeAbp() { ThreadCultureSanitizer.Sanitize(); AbpBootstrapper.Initialize(); }
/// <summary> /// Uses ABP. /// </summary> public static void UseAbp(this IAppBuilder app) { ThreadCultureSanitizer.Sanitize(); }
/// <summary> /// Uses . /// </summary> public static void UseCommonFrame(this IAppBuilder app) { ThreadCultureSanitizer.Sanitize(); }