Beispiel #1
0
 public void OnDestroy()
 {
     if (m_instance == this)
     {
         m_instance = null;
     }
 }
Beispiel #2
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
        {
            app.UseDeveloperExceptionPage();
            app.UseStatusCodePages();
            app.UseStaticFiles();

            app.UseSession();
            //app.UseMvcWithDefaultRoute();

            app.UseAuthentication();    // аутентификация
            app.UseAuthorization();     // авторизация

            app.UseMvc(routes =>
            {
                routes.MapRoute(name: "default", template: "{controller=Home}/{action=Index}/{id?}");
                //routes.MapRoute(name: "categoryFilter", template: "Car/{action}/{category?}", defaults: new { Controller = "Car", action = "List" });
            });


            using (var scope = app.ApplicationServices.CreateScope())
            {
                AppDBContent content = scope.ServiceProvider.GetRequiredService <AppDBContent>();
                DBObjects.initial(content);
            }
        }
Beispiel #3
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app)
        {
            app.UseSession();   // добавляем механизм работы с сессиями
            //app.Run(async (context) =>
            //{
            //    if (context.Session.Keys.Contains("name"))
            //        await context.Response.WriteAsync($"Hello {context.Session.GetString("name")}!");
            //    else
            //    {
            //        context.Session.SetString("name", "Tom");
            //        await context.Response.WriteAsync("Hello World!");
            //    }
            //});
            app.UseDeveloperExceptionPage();
            app.UseStatusCodePages();
            app.UseStaticFiles();
            app.UseMvcWithDefaultRoute();
            //app.UseRouting();

            using (var scope = app.ApplicationServices.CreateScope())
            {
                AppDBContent content = scope.ServiceProvider.GetRequiredService <AppDBContent>();
                DBObjects.Initial(content);
            }
        }
Beispiel #4
0
        public void Configure(IApplicationBuilder app, IHostingEnvironment env)
        {
            app.UseDeveloperExceptionPage();
            app.UseStatusCodePages();
            app.UseStaticFiles();
            app.UseSession();
            //app.UseMvcWithDefaultRoute();
            app.UseMvc(router =>
            {
                router.MapRoute(name: "default", template: "{controller=Home}/{action=Index}/{id?}");
                router.MapRoute(name: "categoryFilter", template: "Dishes/{action}/{category?}", defaults: new { Controller = "Dishes", action = "List" });
            });



            using (var scope = app.ApplicationServices.CreateScope())
            {
                AppDBContent content = scope.ServiceProvider.GetRequiredService <AppDBContent>();
                DBObjects.Initial(content);
            }


            //if (env.IsDevelopment())
            //{
            //    app.UseDeveloperExceptionPage();
            //}

            //app.Run(async (context) =>
            //{
            //    await context.Response.WriteAsync("Hello World!");
            //});
        }
Beispiel #5
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
        {
            app.UseDeveloperExceptionPage();
            app.UseStatusCodePages();
            app.UseStaticFiles();
            app.UseSession();
            app.UseMvcWithDefaultRoute();//если не указан URL, то используем тот, который "по умолчанию", то есть index.html
            //AppDBContent content;
            using (var scope = app.ApplicationServices.CreateScope())
            {
                AppDBContent content = scope.ServiceProvider.GetRequiredService <AppDBContent>();
                DBObjects.initial(content);
            }

            /*
             * if (env.IsDevelopment())
             * {
             *  app.UseDeveloperExceptionPage();
             * }
             *
             * app.UseRouting();
             *
             * app.UseEndpoints(endpoints =>
             * {
             *  endpoints.MapGet("/", async context =>
             *  {
             *      await context.Response.WriteAsync("Hello World!");
             *  });
             * });
             */
        }
Beispiel #6
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env)
        {
            if (app == null)
            {
                throw new ArgumentNullException(nameof(app));
            }
            if (env == null)
            {
                throw new ArgumentNullException(nameof(env));
            }

            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
                app.UseStatusCodePages();
                app.UseStaticFiles();
                app.UseSession();
                //app.UseMvcWithDefaultRoute();
                app.UseMvc(routes => {
                    routes.MapRoute(name: "default", template: "{controller=Home}/{action=Index}/{Id?}");
                    routes.MapRoute(name: "categoryFiles", template: "Car/ListCars/{category?}", defaults: new { Controller = "car", action = "ListCars" });
                });
            }
            else
            {
                app.UseHsts();
            }

            using (var scope = app.ApplicationServices.CreateScope())
            {
                AppDBContent content = scope.ServiceProvider.GetRequiredService <AppDBContent>();
                DBObjects.Initial(content);
            }
        }
Beispiel #7
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(Configuration.GetSection("Logging"));
            //loggerFactory.AddDebug();
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }
            app.UseStatusCodePagesWithReExecute("/StatusCode/{0}");
            app.UseStaticFiles();
            app.UseCookiePolicy();
            app.UseAuthentication();

            app.UseMvc(routes =>
            {
                routes.MapRoute(
                    name: "default",
                    template: "{controller=Home}/{action=Index}/{id?}");
                routes.MapRoute(
                    name: "Getpost",
                    template: "Blog/Post/{id?}", defaults: new { Controller = "Blog", action = "Post" });
            });
            using (var scope = app.ApplicationServices.CreateScope())
            {
                DBContext content = scope.ServiceProvider.GetRequiredService <DBContext>();
                DBObjects.Initial(content);
            }
        }
Beispiel #8
0
        public void Configure(IApplicationBuilder app)
        {
            app.UseDeveloperExceptionPage(); //отображать сообщения об ошибках
            app.UseStatusCodePages();        //отображать код ошибок
            app.UseStaticFiles();            //работать с статическими файлами
            app.UseSession();                //используем сессии
            app.UseSwagger();
            app.UseSwaggerUI(c =>
            {
                c.SwaggerEndpoint("/swagger/v1/swagger.json", "My API V1");
            });
            app.UseRouting();

            app.UseEndpoints(endpoints =>
            {
                endpoints.MapControllerRoute(
                    name: "default",
                    pattern: "{controller=Home}/{action=Index}/{id?}");
            });

            //подключение к AppDBContent - БД
            using (var scope = app.ApplicationServices.CreateScope())
            {
                AppDBContent content = scope.ServiceProvider.GetRequiredService <AppDBContent>();
                //при старте программы вызвается
                DBObjects.Initial(content);
            };
        }
Beispiel #9
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
        {
            // app.UseDeveloperExceptionPage();
            //  app.UseStatusCodePages();
            //  app.UseStaticFiles();
            // app.UseMvcWithDefaultRoute();
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
                app.UseStatusCodePages();
            }

            app.UseRouting();
            app.UseStaticFiles();
            app.UseSession();

            app.UseEndpoints(endpoints =>
                             { endpoints.MapControllerRoute("Default", "{controller=Home}/{action=Index}/{id?}");
                               endpoints.MapControllerRoute("categoryFilter", "Car/{action}/{category?}", defaults: new { Controllers = "Car", action = "List" }); });


            using (var scope = app.ApplicationServices.CreateScope())
            {
                AppDBContent content = scope.ServiceProvider.GetRequiredService <AppDBContent>();
                DBObjects.Initial(content);
            }
        }
Beispiel #10
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
        {
            app.UseDeveloperExceptionPage();
            app.UseStatusCodePages();
            app.UseStaticFiles();
            app.UseSession();
            //app.UseMvcWithDefaultRoute();

            app.UseRouting();

            app.UseEndpoints(endpoints =>
            {
                endpoints.MapControllers(); // подключаем маршрутизацию на контроллеры
            });

            app.UseMvc(routes =>
            {
                routes.MapRoute(name: "default", template: "{controller=Home}/{action=Index}/{Id?}");
                routes.MapRoute(name: "categoryFilter", template: "Lamp/{action}/{category?}", defaults: new { Controller = "Lamp", action = "List" });
            });

            using (var scope = app.ApplicationServices.CreateScope())
            {
                AppDBContent content = scope.ServiceProvider.GetRequiredService <AppDBContent>();
                DBObjects.Initial(content);
            }

            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }
        }
Beispiel #11
0
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
                app.UseStatusCodePages();
                app.UseStaticFiles();
                app.UseSession();
                //app.UseRouting();
                app.UseMvc(routes =>
                {
                    routes.MapRoute(name: "default", template: "{controller=Home}/{action=Index}/{id?}");
                    routes.MapRoute(name: "categoryFilter", template: "Car/{action}/{category?}", defaults: new { Controller = "Car", action = "List" });
                });

                using (var scope = app.ApplicationServices.CreateScope())
                {
                    AppDBContent content = scope.ServiceProvider.GetRequiredService <AppDBContent>();
                    DBObjects.Initial(content);
                }

                //app.UseEndpoints(endpoints =>
                //{
                //    // определение маршрутов
                //    endpoints.MapControllerRoute(
                //        name: "default",
                //        pattern: "{controller=Home}/{action=Index}/{id?}");
                //});
            }
        }
Beispiel #12
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
                app.UseStatusCodePages();
            }

            app.UseRouting();
            app.UseStaticFiles();
            app.UseSession();

            app.UseEndpoints(endpoints =>
            {
                endpoints.MapControllerRoute(
                    name: "/",
                    pattern: "{controller=Default}/{action=Default}");

                endpoints.MapDefaultControllerRoute();
            });

            using (var scope = app.ApplicationServices.CreateScope())
            {
                DBContent dbContent = scope.ServiceProvider.GetRequiredService <DBContent>();
                DBObjects.Initial(dbContent);
            }
        }
Beispiel #13
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
        {
            app.UseDeveloperExceptionPage();
            app.UseStatusCodePages();
            app.UseStaticFiles();
            app.UseSession();
            //app.UseMvcWithDefaultRoute();
            app.UseMvc(routes =>
            {
                routes.MapRoute(name: "default", template: "{controller=Home}/{action=Index}/{id?}");
                routes.MapRoute(name: "categoryFilter", template: "Car/{action}/{category?}", defaults: new { Controller = "Car", action = "List" });
            });



            using (var scope = app.ApplicationServices.CreateScope())
            {
                AppDBContent content = scope.ServiceProvider.GetRequiredService <AppDBContent>();
                DBObjects.Initial(content);
            }

            /*
             * app.UseRouting();
             *
             * app.UseEndpoints(endpoints =>
             * {
             *  endpoints.MapGet("/", async context =>
             *  {
             *      await context.Response.WriteAsync("Hello World!");
             *  });
             * });
             */
        }
Beispiel #14
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }
            else
            {
                app.UseExceptionHandler("/Home/Error");
                // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
                app.UseHsts();
            }

            app.UseDeveloperExceptionPage();
            app.UseStatusCodePages();
            app.UseStaticFiles();
            app.UseMvcWithDefaultRoute();
            /*app.UseMvcWithDefaultRoute();*/



            using (var scope = app.ApplicationServices.CreateScope())
            {
                AppDBContent content = scope.ServiceProvider.GetRequiredService <AppDBContent>();
                DBObjects.Initial(content);
            }
            ///////////////////////////////////DBObjects.Initial(app);

            /*app.UseEndpoints(endpoints =>
             * {
             *  endpoints.MapControllerRoute(
             *      name: "default",
             *      pattern: "{controller=Home}/{action=Index}/{id?}");
             * });*/
        }
Beispiel #15
0
        public void Configure(IApplicationBuilder app, IHostingEnvironment env)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();

                /* app.Run(async context =>
                 * {
                 *   await context.Response.WriteAsync("Hello, World!");
                 * });*/

                using (var scope = app.ApplicationServices.CreateScope())
                {
                    AppDBContent content = scope.ServiceProvider.GetRequiredService <AppDBContent>();
                    DBObjects.Initial(content);
                }
            }

            else
            {
                app.UseHsts();
            }

            app.UseHttpsRedirection();
            app.UseMvc();
        }
Beispiel #16
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env)
        {
            _logger.LogInformation("########################## Configure");
            app.UseDeveloperExceptionPage(); //отображение страницы с ошибками
            app.UseStatusCodePages();        //отображение кода страниц
            app.UseStaticFiles();            //отображение статических файлов(css, img...)(добавляется через nuget)
            app.UseSession();
            //app.UseMvcWithDefaultRoute(); //если не указываем путь страницы будет использоваться url по умолчанию
            app.UseMvc(routes =>
            {
                routes.MapRoute(name: "default", template: "{controller=Home}/{action=Index}");///{id?}");
                routes.MapRoute(name: "items", template: "Items/{action?}/{categoryName?}", defaults: new { Controller = "Items", action = "List" });
                routes.MapRoute(name: "auth", template: "Auth/{action?}", defaults: new { Controller = "Auth", action = "Login" });
                routes.MapRoute(name: "controlPanel", template: "ControlPanel/{action?}", defaults: new { Controller = "ControlPanel", action = "Menu" });
                routes.MapRoute(name: "categoryManage", template: "CategoryManage/{action?}/{id?}", defaults: new { Controller = "CategoryManage", action = "List" });
                routes.MapRoute(name: "itemManage", template: "ItemManage/{action?}/{categoryName?}", defaults: new { Controller = "ItemManage", action = "List" });
                routes.MapRoute(name: "shopCart", template: "ShopCart/{action?}", defaults: new { Controller = "ShopCart", action = "Index" });
                routes.MapRoute(name: "order", template: "Order/{action?}", defaults: new { Controller = "Order", action = "Checkout" });
                routes.MapRoute(name: "imgManage", template: "ImgManage/{action?}", defaults: new { Controller = "ImgManage", action = "List" });
            });

            //заполнение бд первоначальное
            using (var scope = app.ApplicationServices.CreateScope())
            {
                AppDBContent appDBContent = scope.ServiceProvider.GetRequiredService <AppDBContent>();
                DBObjects.Initial(appDBContent);
            }
        }
Beispiel #17
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
        {
            app.UseDeveloperExceptionPage();
            app.UseStatusCodePages();/* 404, 200 .. */
            app.UseStaticFiles();
            app.UseSession();
            app.UseRouting();
            app.UseCors();

            app.UseAuthentication(); // UseIndentity();
            app.UseAuthorization();


            app.UseEndpoints(endpoints =>
            {
                endpoints.MapControllers();
                endpoints.MapControllerRoute("default", "{controller=Home}/{action=Index}/{id?}");
                endpoints.MapControllerRoute("categoryFilter", "Cars/{action}/{category?}", defaults: new { Controller = "Cars", action = "List" }); /* Action tikrai zinome kad tai list bet tebune default
                                                                                                                                                      * category List(string category)
                                                                                                                                                      * ? nebutinas, nes kartais noresime visus tiesiog isvesti  */
            });


            /*     using (var scope = app.ApplicationServices.CreateScope()) *//* Startuojant mes visada kviesime ta funkcija *//*
             *   {
             *       AppDBContent content;
             *       content = scope.ServiceProvider.GetRequiredService<AppDBContent>();
             *   } */

            DBObjects.Initial(app);
        }
Beispiel #18
0
 // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
 public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
 {
     app.UseSession();
     //відображення помилок
     app.UseDeveloperExceptionPage();
     app.UseStatusCodePages();     //відображення коду сторінки 8
     app.UseStaticFiles();         //для відображення різних файлів, таких
                                   //як зображення, css-файли та інше
     app.UseMvcWithDefaultRoute(); //для маршрутизації за замовчування
     using (var scope = app.ApplicationServices.CreateScope())
     {
         AppDBContent content = scope.ServiceProvider.
                                GetRequiredService <AppDBContent>();
         DBObjects.Initial(content);
     }
     app.UseMvcWithDefaultRoute();//для маршрутизації за замовчування
     app.UseSession();
     //прописуємо власну маршрутизацію та url-адреси
     app.UseMvc(routes => {
         routes.MapRoute(name: "default", template: "{controllerHome}/{action-Index}/{id?}");
         routes.MapRoute(name: "categoryFilter", template:
                         "Rooms/{action}/{category?}", defaults: new
         {
             Controller = "Rooms",
             action     = "List"
         });
     });
 }
Beispiel #19
0
        public static async System.Threading.Tasks.Task Main(string[] args)
        {
            var host = CreateHostBuilder(args).Build();

            using (var scope = host.Services.CreateScope())
            {
                var services = scope.ServiceProvider;

                try
                {
                    var userManager  = services.GetRequiredService <UserManager <User> >();
                    var rolesManager = services.GetRequiredService <RoleManager <IdentityRole> >();
                    await RoleInitializer.InitializeAsync(userManager, rolesManager);

                    var context = services.GetRequiredService <BookContext>();
                    DBObjects.Initialize(context);
                }
                catch (Exception ex)
                {
                    var logger = services.GetRequiredService <ILogger <Program> >();
                    logger.LogError(ex, "An error occurred seeding the DB.");
                }
            }
            host.Run();
        }
Beispiel #20
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }
            else
            {
                app.UseStatusCodePagesWithReExecute("/Error/{0}");
            }



            app.UseStaticFiles();
            app.UseCookiePolicy();
            app.UseAuthentication();

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

            using (var scope = app.ApplicationServices.CreateScope())
            {
                DBContent content = scope.ServiceProvider.GetRequiredService <DBContent>();
                DBObjects.DBObjectsData(content);
            }
        }
Beispiel #21
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
                app.UseStatusCodePages();
                app.UseStaticFiles();
                app.UseMvcWithDefaultRoute();
                using (var scope = app.ApplicationServices.CreateScope())
                {
                    AppDBContent content = scope.ServiceProvider.GetRequiredService <AppDBContent>();
                    DBObjects.Initital(content);
                }
            }

            app.UseMvc(routes =>
            {
                routes.MapRoute(
                    name: "calculator",
                    template: "{controller=Login}/Login");


                routes.MapRoute(
                    name: "default",
                    template: "{controller=Hello}/{action=Index}/{id?}");
            });
        }
Beispiel #22
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }
            else
            {
                app.UseExceptionHandler("/Home/Error");

                app.UseStatusCodePages();
                // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
                app.UseHsts();
            }

            app.UseHttpsRedirection();
            app.UseStaticFiles();
            app.UseCookiePolicy();


            using (var scope = app.ApplicationServices.CreateScope())
            {
                AppDBContent content = scope.ServiceProvider.GetRequiredService <AppDBContent>();
                DBObjects.Initial(content);
            }



            app.UseMvc(routes =>
            {
                routes.MapRoute(
                    name: "default",
                    template: "{controller=Home}/{action=Index}/{id?}");
            });
        }
Beispiel #23
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }

            app.UseAuthentication();
            app.UseHttpsRedirection();
            app.UseStaticFiles();
            app.UseSession();
            app.UseCookiePolicy();
            //app.UseCookieAuthentication();


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


            using (var scope = app.ApplicationServices.CreateScope())
            {
                AppDBContent content = scope.ServiceProvider.GetRequiredService <AppDBContent>();
                DBObjects.Initial(content);
            }


            //app.Run(async (context) =>
            //{
            //    await context.Response.WriteAsync("Hello World!");
            //});
        }
Beispiel #24
0
        public async Task TestGetTableAndViews()
        {
            using (var db = new SqliteConnection("Data Source=:memory:"))
            {
                db.Open();
                var sql  = System.IO.File.ReadAllText("sample.sql");
                var sqls = sql.Split("GO", System.StringSplitOptions.RemoveEmptyEntries);
                foreach (var s in sqls)
                {
                    var cmd = db.CreateCommand();
                    cmd.CommandText = s;
                    cmd.ExecuteNonQuery();
                }
                Kull.DatabaseMetadata.DBObjects sqlHelper = new DBObjects();
                var tablesAndViews = (await sqlHelper.GetTablesAndViews(db)).OrderBy(s => s.Name.Name).ToArray();
                Assert.AreEqual(3, tablesAndViews.Length);
                Assert.AreEqual("customer", tablesAndViews[0].Name);
                Assert.AreEqual(DBObjects.TableOrViewType.Table, tablesAndViews[0].Type);
                Assert.AreEqual("employee", tablesAndViews[1].Name);
                Assert.AreEqual("V_Customers", tablesAndViews[2].Name);
                Assert.AreEqual(DBObjects.TableOrViewType.View, tablesAndViews[2].Type);


                var tablesOnly = (await sqlHelper.GetTablesAndViews(db, DBObjects.TableOrViewType.Table));
                Assert.AreEqual(2, tablesOnly.Count);
            }
        }
Beispiel #25
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
        {
            app.UseDeveloperExceptionPage();
            app.UseStatusCodePages();
            app.UseStaticFiles();
            app.UseSession();
            app.UseAuthentication();
            app.UseAuthorization();

            app.UseRouting();
            app.UseEndpoints(endpoints =>
            {
                endpoints.MapRazorPages();
                endpoints.MapHub <ChatHub>("/chatHub");
            });
            app.UseMvc(routes =>
            {
                routes.MapRoute(name: "default",
                                template: "{controller=Home}/{action=Index}/{id?}");
            });

            using (var scope = app.ApplicationServices.CreateScope())
            {
                CarsContext context = scope.ServiceProvider.GetRequiredService <CarsContext>();
                DBObjects.First(context);
            }
        }
Beispiel #26
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
        {
            app.UseDeveloperExceptionPage(); //отображение ошибок
            app.UseStatusCodePages();        //отобразит коды страниц
            app.UseStaticFiles();            //отображает разл картинки css статич файлы

            app.UseSession();
            //app.UseMvcWithDefaultRoute();//url по умолчанию

            //собственный url по умолчанию
            app.UseMvc(routes =>
            {
                routes.MapRoute(name: "default", template: "{controller=Home}/{action=Index}/{Id?}");
                //Car-имя контроллера точно, action-любой метод, category- долж точно соотв параметру в CarsController/List(string category), ?-необяз параметр
                //defaults-по умолчанию
                routes.MapRoute(name: "categoryFilter", template: "Car/{action}/{category?}", defaults: new { Controller = "Car", action = "List" });
            });


            using (var scope = app.ApplicationServices.CreateScope())                             //созд доп окружение
            {
                AppDBContent content = scope.ServiceProvider.GetRequiredService <AppDBContent>(); //подключаем AppDBContent
                DBObjects.Initial(content);                                                       //перебр в метод Initial перем-ю
            }
        }
Beispiel #27
0
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }
            else
            {
                app.UseExceptionHandler("/Home/Error");

                app.UseHsts();
            }
            app.UseHttpsRedirection();
            app.UseStaticFiles();
            app.UseSession();
            app.UseRouting();

            app.UseAuthorization();

            app.UseEndpoints(endpoints =>
            {
                endpoints.MapControllerRoute(
                    name: "default",
                    pattern: "{controller=Home}/{action=Index}/{id?}");
            });


            using (var scope = app.ApplicationServices.CreateScope())
            {
                AppDbContent content = scope.ServiceProvider.GetRequiredService <AppDbContent>();
                DBObjects.Initial(content);
            }
        }
Beispiel #28
0
        public void Configure(IApplicationBuilder app, IHostingEnvironment env)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }
            else
            {
                app.UseExceptionHandler("/Home/Error");
                app.UseHsts();
            }
            //модель - это место, где мы будем хранить некую информацию
            app.UseDeveloperExceptionPage(); //отображать страничку с ошибками
            app.UseStatusCodePages();        //отображать коды страничек
            app.UseStaticFiles();            //отображать различные css файлы, картинки и т.д
            app.UseSession();
            app.UseHttpsRedirection();
            app.UseAuthentication();

            app.UseMvc(routes =>
            {
                routes.MapRoute(name: "default", template: "{controller=Home}/{action=Index}/{id?}");
                routes.MapRoute(name: "categoryFilter", template: "Goods/{action}/{category?}", defaults: new { Controller = "Goods", action = "List" });
            });

            using (var scope = app.ApplicationServices.CreateScope())
            {
                AppDBContent content = scope.ServiceProvider.GetRequiredService <AppDBContent>();
                DBObjects.Initial(content);
            }
        }
Beispiel #29
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
                app.UseHttpsRedirection();
                app.UseStaticFiles();
                app.UseCookiePolicy();
                app.UseStaticFiles();
                app.UseSession();
                app.UseMvcWithDefaultRoute();

                using (var scope = app.ApplicationServices.CreateScope())
                {
                    AppDBContent content = scope.ServiceProvider.GetRequiredService <AppDBContent>();
                    DBObjects.Initial(content);
                }
            }
            else
            {
                app.UseExceptionHandler("/Store/Error");
                app.UseHsts();
            }



            app.UseMvc(routes =>
            {
                routes.MapRoute(
                    name: "default",
                    template: "{controller=Store}/{action=Services}/{id?}");
            });
        }
Beispiel #30
0
    //****************************************************************************************************
    //
    //****************************************************************************************************

    public void Awake()
    {
        if (m_instance == null)
        {
            m_instance = this;
        }
    }