Beispiel #1
0
        public Startup(IConfiguration configuration, IHostingEnvironment env)
        {
            _exceptions = new Dictionary <string, List <Exception> > {
                { ExceptionsOnStartup, new List <Exception>() },
                { ExceptionsOnConfigureServices, new List <Exception>() },
                { ExceptionsOnConfigure, new List <Exception>() },
            };

            try
            {
                Configuration       = configuration;
                _hostingEnvironment = env;

                var builder = new ConfigurationBuilder().SetBasePath(Directory.GetCurrentDirectory()).AddJsonFile("appsettings.json");
                ConfigurationRoot = builder.Build();
                ResetGlobalContext(configuration, env);

                _moduleManager = new ModuleManager();
                _themeManager  = new ThemeManager();

                _startup     = new NetCoreStartup();
                _setupConfig = SetupHelper.LoadSetup();

                GlobalContext.HostingEnvironment = env;

                AddLogger();
            }
            catch (Exception ex)
            {
                _exceptions[ExceptionsOnStartup].Add(ex);
            }
        }
Beispiel #2
0
        public Startup(IHostingEnvironment env)
        {
            _hostingEnvironment = env;

            var builder = new ConfigurationBuilder()
                          .SetBasePath(env.ContentRootPath)
                          .AddJsonFile("appsettings.json", optional: false, reloadOnChange: true)
                          .AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true);

            if (env.IsDevelopment())
            {
                // For more details on using the user secret store see https://go.microsoft.com/fwlink/?LinkID=532709
                builder.AddUserSecrets <Startup>();
            }

            builder.AddEnvironmentVariables();
            Configuration = builder.Build();

            GlobalConfig.ContentRootPath = env.ContentRootPath;
            GlobalConfig.WebRootPath     = env.WebRootPath;

            _moduleManager = new ModuleManager();
            var setupConfig = SetupHelper.LoadSetup();

            _startup = new NetCoreStartup();
        }
Beispiel #3
0
        public Startup(IConfiguration configuration, IHostingEnvironment env)
        {
            Configuration       = configuration;
            _hostingEnvironment = env;

            var builder = new ConfigurationBuilder().SetBasePath(Directory.GetCurrentDirectory()).AddJsonFile("appsettings.json");

            ConfigurationRoot = builder.Build();
            ResetGlobalContext(configuration, env);

            _moduleManager = new ModuleManager();
            _themeManager  = new ThemeManager();
            _startup       = new NetCoreStartup();
            _setupConfig   = SetupHelper.LoadSetup();
            AddLogger();
        }
Beispiel #4
0
        public Startup(IConfiguration configuration, IHostingEnvironment env)
        {
            Configuration       = configuration;
            _hostingEnvironment = env;

            GlobalConfig.ContentRootPath = env.ContentRootPath;
            GlobalConfig.WebRootPath     = env.WebRootPath;

            var builder = new ConfigurationBuilder().SetBasePath(Directory.GetCurrentDirectory()).AddJsonFile("appsettings.json");

            ConfigurationRoot = builder.Build();

            _moduleManager = new ModuleManager();
            _setupConfig   = SetupHelper.LoadSetup();
            _startup       = new NetCoreStartup();

            var logFilePath = NccInfo.LogFolder + "\\NccLogs-{Date}.log";

            Log.Logger = new LoggerConfiguration().Enrich.FromLogContext().WriteTo.RollingFile(logFilePath).CreateLogger();
        }