Advertisement
Ousterfort

Program.cs

Feb 6th, 2025
48
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.65 KB | Source Code | 0 0
  1. using ejemplo_crud_MVC_sqlServer;
  2. using Microsoft.EntityFrameworkCore;
  3. using System;
  4.  
  5. var builder = WebApplication.CreateBuilder(args);
  6.  
  7. builder.Services.AddControllersWithViews();
  8.  
  9. builder.Services.AddDbContext<ApplicationDbContext>(options =>
  10.     options.UseSqlServer(builder.Configuration.GetConnectionString("DefaultConnection"))
  11. );
  12.  
  13. var app = builder.Build();
  14.  
  15. if (!app.Environment.IsDevelopment())
  16. {
  17.     app.UseExceptionHandler("/Home/Error");
  18. }
  19. app.UseStaticFiles();
  20.  
  21. app.UseRouting();
  22.  
  23. app.UseAuthorization();
  24.  
  25. app.MapControllerRoute(
  26.     name: "default",
  27.     pattern: "{controller=Productos}/{action=Index}/{id?}");
  28.  
  29. app.Run();
  30.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement