コード例 #1
0
        static void Main(string[] args)
        {
            /* EF Solution to Problem 20.Products by One Distributor
             * Feb.19, 2017 Exam (Databases Basics - MS SQL Server) */
            BakeryContext context            = new BakeryContext();
            var           singleDistProducts = context.Products
                                               .Where(ProductHasSingleDistributor)
                                               .OrderBy(p => p.Id);

            PrintProducts(singleDistProducts);
        }
コード例 #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, BakeryContext context)
        {
            context.Database.Migrate();

            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }
            else
            {
                app.UseExceptionHandler("/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.UseHttpsRedirection();
            app.UseStaticFiles();
            app.UseCookiePolicy();

            app.UseMvc();
        }