Пример #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,
                              IAuthServerContext dbContext)
        {
            app.UseSession();

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

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

            app.UseCookieAuthentication(new CookieAuthenticationOptions
            {
                AuthenticationScheme  = "Cookie",
                LoginPath             = new PathString("/Account/LoginPage/"),
                AccessDeniedPath      = new PathString("/Account/LoginPage/"),
                AutomaticAuthenticate = true,
                AutomaticChallenge    = true
            });

            app.UseStaticFiles();

            app.UseMvc(routes =>
            {
                routes.MapRoute("DefaultRest",
                                "{controller}/{id?}");

                routes.MapRoute(
                    "default",
                    "{controller=Account}/{action=LoginPage}/{id?}");
            });

            // configuring logging
            Log.Logger = new LoggerConfiguration()
                         .WriteTo.RollingFile("C:\\CSharpInternship16DontDelete\\Logs\\managementapp-{Date}.log",
                                              outputTemplate:
                                              "{Timestamp:dd-MM-yyyy HH:mm:ss.fff} [{Level}] ({ThreadId}) {Message}{NewLine}{Exception}")
                         .Enrich.WithThreadId()
                         .CreateLogger();

            // apply pending migrations, log exception and throw exception to prevent application from starting

            try
            {
                dbContext.PerformMigration();
            }
            catch (Exception ex)
            {
                Log.Error($"<Startup> Unable to PerformMigration(), exception stack trace: {ex.StackTrace}");
                throw;
            }

            SetAuthServerClientConfiguration();
            SetManagementAppEmailConfiguration();
        }
 public ProjectRepository(IAuthServerContext context) : base(context)
 {
     _db = context;
 }
Пример #3
0
 protected GenericRepository(IAuthServerContext context)
 {
     Entities = context;
     Dbset    = context.Set <T>();
 }
Пример #4
0
 public UserCustomDataRepository(IAuthServerContext context) : base(context)
 {
     _db = context;
 }
 public AuditLogRepository(IAuthServerContext context)
 {
     _db = context;
 }