示例#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, TunnelRContext database, IServiceProvider serviceProvider)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }
            else
            {
                app.UseHsts();
            }

            app.UseSignalR(routes => { routes.MapHub <ClientHub>("/client"); });
            app.UseAuthentication();
            app.UseMvc();

            database.Database.Migrate();
            //Ensure sessions are wiped on boot.
            database.Database.ExecuteSqlCommand("TRUNCATE TABLE UserSession");

            serviceProvider.CreateRoles().Wait();
        }
示例#2
0
 public static void LogMacAddress(this TunnelRContext context, TunnelRUser user, PhysicalAddress macAddress)
 {
     context.MagAddressLog.Add(new MacAddressLog(user, macAddress.ToString()));
     context.SaveChanges();
 }