示例#1
0
        public void Configure(
            IApplicationBuilder app,
            IDatabaseManager databaseManager,
            ISeedManager seedManager,
            ILoggerFactory loggerFactory,
            IRethinkDbManager rethinkDbManager,
            ISocketOptions socketOptions,
            ISocketMiddleware socketMiddleware)
        {
            if (Env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
                app.UseWebpackDevMiddleware(new WebpackDevMiddlewareOptions
                {
                    HotModuleReplacement = true
                });

                app.UseCors("CorsPolicy");
            }
            else
            {
                app.UseExceptionHandler("/Home/Error");
            }

            loggerFactory.AddFile("Logs/logs-{Date}.txt", LogLevel.Error);

            app.UseStaticFiles();

            app.UseAuthentication();

            app.UseWebSockets(socketOptions.GetOptions());
            app.Use(async(context, next) => await socketMiddleware.Invoke(context, next));

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

                routes.MapSpaFallbackRoute(
                    name: "spa-fallback",
                    defaults: new { controller = "Home", action = "Index" });
            });

            rethinkDbManager.EnsureDatabaseCreated();
            databaseManager.EnsureDatabaseCreated();

            seedManager.Seed();

            app.UseMvcWithDefaultRoute();
        }
        public async Task <List <Room> > SeedRooms()
        {
            var results = await _roomManager.Seed();

            return(results);
        }
        public async Task <List <User> > SeedUsers()
        {
            var results = await _userManager.Seed();

            return(results);
        }