diff --git a/aspnetcore/tutorials/razor-pages/razor-pages-start/sample/RazorPagesMovie30/Program.cs b/aspnetcore/tutorials/razor-pages/razor-pages-start/sample/RazorPagesMovie30/Program.cs index 8db5b5ad40..554ef3fee5 100644 --- a/aspnetcore/tutorials/razor-pages/razor-pages-start/sample/RazorPagesMovie30/Program.cs +++ b/aspnetcore/tutorials/razor-pages/razor-pages-start/sample/RazorPagesMovie30/Program.cs @@ -2,7 +2,6 @@ using Microsoft.AspNetCore.Hosting; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Logging; -using RazorPagesMovie.Data; using RazorPagesMovie.Models; using System; @@ -20,8 +19,6 @@ namespace RazorPagesMovie try { - var context = services. - GetRequiredService(); SeedData.Initialize(services); } catch (Exception ex) @@ -39,9 +36,7 @@ namespace RazorPagesMovie Host.CreateDefaultBuilder(args) .ConfigureWebHostDefaults(webBuilder => { - // webBuilder.UseStartup(); - webBuilder.UseStartup(); - + webBuilder.UseStartup(); }); } } diff --git a/aspnetcore/tutorials/razor-pages/razor-pages-start/sample/RazorPagesMovie30/StartupVal.cs b/aspnetcore/tutorials/razor-pages/razor-pages-start/sample/RazorPagesMovie30/StartupVal.cs deleted file mode 100644 index ff671d2af3..0000000000 --- a/aspnetcore/tutorials/razor-pages/razor-pages-start/sample/RazorPagesMovie30/StartupVal.cs +++ /dev/null @@ -1,58 +0,0 @@ -using Microsoft.AspNetCore.Builder; -using Microsoft.AspNetCore.Hosting; -using Microsoft.AspNetCore.Mvc.ViewFeatures; -using Microsoft.EntityFrameworkCore; -using Microsoft.Extensions.Configuration; -using Microsoft.Extensions.DependencyInjection; -using Microsoft.Extensions.Hosting; -using RazorPagesMovie.Data; - -namespace RazorPagesMovie -{ - public class StartupVal - { - public StartupVal(IConfiguration configuration) - { - Configuration = configuration; - } - - public IConfiguration Configuration { get; } - - #region snippet_ConfigureServices -public void ConfigureServices(IServiceCollection services) -{ - services.AddRazorPages(); - - services.Configure(o => o.ClientValidationEnabled = false); - - services.AddDbContext(options => - options.UseSqlServer(Configuration.GetConnectionString("RazorPagesMovieContext"))); -} - #endregion - - public void Configure(IApplicationBuilder app, IWebHostEnvironment env) - { - if (env.IsDevelopment()) - { - app.UseDeveloperExceptionPage(); - } - else - { - app.UseExceptionHandler("/Error"); - app.UseHsts(); - } - - app.UseHttpsRedirection(); - app.UseStaticFiles(); - - app.UseRouting(); - - app.UseAuthorization(); - - app.UseEndpoints(endpoints => - { - endpoints.MapRazorPages(); - }); - } - } -}