예제 #1
0
        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
            });
        }
예제 #2
0
        public void ListFilesAndDirectoriesTest()
        {
            var listFiles = _defaultVirtualPathProvider.ListFiles("/").ToList();

            var listDirectories = _defaultVirtualPathProvider.ListDirectories("/").ToList();
        }