Ejemplo n.º 1
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
        {
            loggerFactory.AddConsole(ErechtheionConfiguration.Configuration.GetSection("Logging"));
            loggerFactory.AddDebug();
            loggerFactory.AddSerilog();

            if (env.IsDevelopment())
            {
                app.UseBrowserLink();
                app.UseDeveloperExceptionPage();
                app.UseDatabaseErrorPage();
            }
            else
            {
                app.UseExceptionHandler("/Home/Error");
            }

            app.UseStaticFiles();

            app.UseAuthentication();

            app.UseMvc(routes =>
            {
                routes.MapRoute(
                    name: "default",
                    template: "{controller=Home}/{action=Index}/{id?}");
            });

            AutoMapperConfiguration.CreateMap();
        }
Ejemplo n.º 2
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
        {
            app.UseHttpProfiler();

            var config = app.ApplicationServices.GetRequiredService <ICommonConfiguration>();

            config.AppConfiguration = Configuration;
            config.Tokens           = Configuration.GetSection(DotnetSpiderConsts.DefaultSetting).GetValue <string>(DotnetSpiderConsts.Tokens).Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries).Where(t => !string.IsNullOrEmpty(t) && !string.IsNullOrWhiteSpace(t)).ToArray();

            var code = Configuration.GetSection(DotnetSpiderConsts.DefaultSetting).GetValue <string>(DotnetSpiderConsts.SqlEncryptCode).Trim();

            config.SqlEncryptKey = Encoding.ASCII.GetBytes(code);

            LogManager.Configuration.Variables["connectionString"] = Configuration.GetSection("ConnectionStrings").GetValue <string>(DotnetSpiderConsts.ConnectionName);

            loggerFactory.AddConsole(Configuration.GetSection("Logging"));
            loggerFactory.AddDebug();
            loggerFactory.AddNLog();

            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
                app.UseDatabaseErrorPage();
                app.UseBrowserLink();
            }
            else
            {
                app.UseExceptionHandler("/Home/Error");
            }

            AuthConfigure.Configure(app, Configuration);

            app.UseStaticFiles();

            app.UseAuthentication();

            //Session
            app.UseSession();

            app.UseMvc(routes =>
            {
                routes.MapRoute(
                    name: "default",
                    template: "{controller=Home}/{action=Index}/{id?}");
            });

            AutoMapperConfiguration.CreateMap();

            if (env.IsDevelopment())
            {
                SeedData.Initialize(app.ApplicationServices);
            }
            if (!env.IsDevelopment())
            {
                SeedData.InitializeScheduler(app.ApplicationServices);
            }
        }
 private static void CreateMap()
 {
     AutoMapperConfiguration.CreateMap();
     Mapper.Instance.ConfigurationProvider.BuildExecutionPlan(typeof(ID4EFM.Client), typeof(ID4M.Client));
 }