Implement initial product management with Entity Framework Core #3
This commit is contained in:
@@ -6,17 +6,19 @@ using Microsoft.Identity.Web.Resource;
|
||||
|
||||
namespace Api
|
||||
{
|
||||
public class Program
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Api.Models;
|
||||
public static class Program
|
||||
{
|
||||
public static void Main(string[] args)
|
||||
{
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
|
||||
// Add services to the container.
|
||||
//builder.Services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme)
|
||||
// .AddMicrosoftIdentityWebApi(builder.Configuration.GetSection("AzureAd"));
|
||||
|
||||
builder.Services.AddControllers();
|
||||
// Add DbContext with SQL Server
|
||||
builder.Services.AddDbContext<AppDbContext>(options =>
|
||||
options.UseSqlServer(builder.Configuration.GetConnectionString("DefaultConnection")));
|
||||
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
|
||||
builder.Services.AddEndpointsApiExplorer();
|
||||
builder.Services.AddSwaggerGen();
|
||||
@@ -24,19 +26,14 @@ namespace Api
|
||||
var app = builder.Build();
|
||||
|
||||
// Configure the HTTP request pipeline.
|
||||
// if (app.Environment.IsDevelopment())
|
||||
// {
|
||||
app.UseSwagger();
|
||||
app.UseSwaggerUI();
|
||||
// }
|
||||
app.UseSwagger();
|
||||
app.UseSwaggerUI();
|
||||
|
||||
if (!app.Environment.IsDevelopment())
|
||||
{
|
||||
app.UseHttpsRedirection();
|
||||
}
|
||||
|
||||
// app.UseAuthorization();
|
||||
|
||||
app.MapControllers();
|
||||
|
||||
app.Run();
|
||||
|
||||
Reference in New Issue
Block a user