diff --git a/src/nuget.config b/nuget.config
similarity index 97%
rename from src/nuget.config
rename to nuget.config
index 719ff50f..023d22cf 100644
--- a/src/nuget.config
+++ b/nuget.config
@@ -1,8 +1,8 @@
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
diff --git a/save-points/00-get-started/BlazingPizza.Client/BlazingPizza.Client.csproj b/save-points/00-get-started/BlazingPizza.Client/BlazingPizza.Client.csproj
index bfef7295..86250f68 100644
--- a/save-points/00-get-started/BlazingPizza.Client/BlazingPizza.Client.csproj
+++ b/save-points/00-get-started/BlazingPizza.Client/BlazingPizza.Client.csproj
@@ -2,6 +2,7 @@
$(TargetFrameworkVersion)
+ true
diff --git a/save-points/00-get-started/BlazingPizza.Client/Program.cs b/save-points/00-get-started/BlazingPizza.Client/Program.cs
index 48147d6f..ab7dd4d9 100644
--- a/save-points/00-get-started/BlazingPizza.Client/Program.cs
+++ b/save-points/00-get-started/BlazingPizza.Client/Program.cs
@@ -1,21 +1,9 @@
-using Microsoft.AspNetCore.Components.WebAssembly.Hosting;
-using Microsoft.Extensions.DependencyInjection;
-using System;
-using System.Net.Http;
-using System.Threading.Tasks;
+using BlazingPizza.Client;
+using Microsoft.AspNetCore.Components.WebAssembly.Hosting;
-namespace BlazingPizza.Client
-{
- public class Program
- {
- public static async Task Main(string[] args)
- {
- var builder = WebAssemblyHostBuilder.CreateDefault(args);
- builder.RootComponents.Add("#app");
+var builder = WebAssemblyHostBuilder.CreateDefault(args);
+builder.RootComponents.Add("#app");
- builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri(builder.HostEnvironment.BaseAddress) });
+builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri(builder.HostEnvironment.BaseAddress) });
- await builder.Build().RunAsync();
- }
- }
-}
+await builder.Build().RunAsync();
diff --git a/save-points/00-get-started/BlazingPizza.ComponentsLibrary/BlazingPizza.ComponentsLibrary.csproj b/save-points/00-get-started/BlazingPizza.ComponentsLibrary/BlazingPizza.ComponentsLibrary.csproj
index 61ebf623..cb996b1b 100644
--- a/save-points/00-get-started/BlazingPizza.ComponentsLibrary/BlazingPizza.ComponentsLibrary.csproj
+++ b/save-points/00-get-started/BlazingPizza.ComponentsLibrary/BlazingPizza.ComponentsLibrary.csproj
@@ -2,6 +2,7 @@
$(TargetFrameworkVersion)
+ true
diff --git a/save-points/00-get-started/BlazingPizza.ComponentsLibrary/LocalStorage.cs b/save-points/00-get-started/BlazingPizza.ComponentsLibrary/LocalStorage.cs
index f36b098e..1b91cef9 100644
--- a/save-points/00-get-started/BlazingPizza.ComponentsLibrary/LocalStorage.cs
+++ b/save-points/00-get-started/BlazingPizza.ComponentsLibrary/LocalStorage.cs
@@ -1,17 +1,15 @@
using Microsoft.JSInterop;
-using System.Threading.Tasks;
-namespace BlazingPizza.ComponentsLibrary
+namespace BlazingPizza.ComponentsLibrary;
+
+public static class LocalStorage
{
- public static class LocalStorage
- {
- public static ValueTask GetAsync(IJSRuntime jsRuntime, string key)
- => jsRuntime.InvokeAsync("blazorLocalStorage.get", key);
+ public static ValueTask GetAsync(IJSRuntime jsRuntime, string key)
+ => jsRuntime.InvokeAsync("blazorLocalStorage.get", key);
- public static ValueTask SetAsync(IJSRuntime jsRuntime, string key, object value)
- => jsRuntime.InvokeVoidAsync("blazorLocalStorage.set", key, value);
+ public static ValueTask SetAsync(IJSRuntime jsRuntime, string key, object value)
+ => jsRuntime.InvokeVoidAsync("blazorLocalStorage.set", key, value);
- public static ValueTask DeleteAsync(IJSRuntime jsRuntime, string key)
- => jsRuntime.InvokeVoidAsync("blazorLocalStorage.delete", key);
- }
+ public static ValueTask DeleteAsync(IJSRuntime jsRuntime, string key)
+ => jsRuntime.InvokeVoidAsync("blazorLocalStorage.delete", key);
}
diff --git a/save-points/00-get-started/BlazingPizza.Server/BlazingPizza.Server.csproj b/save-points/00-get-started/BlazingPizza.Server/BlazingPizza.Server.csproj
index b9c74fc4..227890e1 100644
--- a/save-points/00-get-started/BlazingPizza.Server/BlazingPizza.Server.csproj
+++ b/save-points/00-get-started/BlazingPizza.Server/BlazingPizza.Server.csproj
@@ -2,6 +2,7 @@
$(TargetFrameworkVersion)
+ true
diff --git a/save-points/00-get-started/BlazingPizza.Server/NotificationsController.cs b/save-points/00-get-started/BlazingPizza.Server/NotificationsController.cs
deleted file mode 100644
index bb3b96ff..00000000
--- a/save-points/00-get-started/BlazingPizza.Server/NotificationsController.cs
+++ /dev/null
@@ -1,43 +0,0 @@
-using System.Linq;
-using System.Security.Claims;
-using System.Threading.Tasks;
-using Microsoft.AspNetCore.Authorization;
-using Microsoft.AspNetCore.Mvc;
-
-namespace BlazingPizza.Server
-{
- [Route("notifications")]
- [ApiController]
- [Authorize]
- public class NotificationsController : Controller
- {
- private readonly PizzaStoreContext _db;
-
- public NotificationsController(PizzaStoreContext db)
- {
- _db = db;
- }
-
- [HttpPut("subscribe")]
- public async Task Subscribe(NotificationSubscription subscription)
- {
- // We're storing at most one subscription per user, so delete old ones.
- // Alternatively, you could let the user register multiple subscriptions from different browsers/devices.
- var userId = GetUserId();
- var oldSubscriptions = _db.NotificationSubscriptions.Where(e => e.UserId == userId);
- _db.NotificationSubscriptions.RemoveRange(oldSubscriptions);
-
- // Store new subscription
- subscription.UserId = userId;
- _db.NotificationSubscriptions.Attach(subscription);
-
- await _db.SaveChangesAsync();
- return subscription;
- }
-
- private string GetUserId()
- {
- return HttpContext.User.FindFirstValue(ClaimTypes.NameIdentifier);
- }
- }
-}
diff --git a/save-points/00-get-started/BlazingPizza.Server/OidcConfigurationController.cs b/save-points/00-get-started/BlazingPizza.Server/OidcConfigurationController.cs
index c074debf..b7654075 100644
--- a/save-points/00-get-started/BlazingPizza.Server/OidcConfigurationController.cs
+++ b/save-points/00-get-started/BlazingPizza.Server/OidcConfigurationController.cs
@@ -1,26 +1,21 @@
using Microsoft.AspNetCore.ApiAuthorization.IdentityServer;
using Microsoft.AspNetCore.Mvc;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Threading.Tasks;
-namespace BlazingPizza.Server
+namespace BlazingPizza.Server;
+
+public class OidcConfigurationController : Controller
{
- public class OidcConfigurationController : Controller
- {
- public OidcConfigurationController(IClientRequestParametersProvider clientRequestParametersProvider)
- {
- ClientRequestParametersProvider = clientRequestParametersProvider;
- }
+ public OidcConfigurationController(IClientRequestParametersProvider clientRequestParametersProvider)
+ {
+ ClientRequestParametersProvider = clientRequestParametersProvider;
+ }
- public IClientRequestParametersProvider ClientRequestParametersProvider { get; }
+ public IClientRequestParametersProvider ClientRequestParametersProvider { get; }
- [HttpGet("_configuration/{clientId}")]
- public IActionResult GetClientRequestParameters([FromRoute]string clientId)
- {
- var parameters = ClientRequestParametersProvider.GetClientParameters(HttpContext, clientId);
- return Ok(parameters);
- }
- }
-}
+ [HttpGet("_configuration/{clientId}")]
+ public IActionResult GetClientRequestParameters([FromRoute] string clientId)
+ {
+ var parameters = ClientRequestParametersProvider.GetClientParameters(HttpContext, clientId);
+ return Ok(parameters);
+ }
+}
\ No newline at end of file
diff --git a/save-points/00-get-started/BlazingPizza.Server/OrdersController.cs b/save-points/00-get-started/BlazingPizza.Server/OrdersController.cs
index 2b8bc99b..54ff6114 100644
--- a/save-points/00-get-started/BlazingPizza.Server/OrdersController.cs
+++ b/save-points/00-get-started/BlazingPizza.Server/OrdersController.cs
@@ -1,114 +1,109 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Security.Claims;
-using System.Threading.Tasks;
+using System.Security.Claims;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
-namespace BlazingPizza.Server
+namespace BlazingPizza.Server;
+
+[Route("orders")]
+[ApiController]
+// [Authorize]
+public class OrdersController : Controller
{
- [Route("orders")]
- [ApiController]
- // [Authorize]
- public class OrdersController : Controller
- {
- private readonly PizzaStoreContext _db;
-
- public OrdersController(PizzaStoreContext db)
- {
- _db = db;
- }
-
- [HttpGet]
- public async Task>> GetOrders()
- {
- var orders = await _db.Orders
- // .Where(o => o.UserId == GetUserId())
- .Include(o => o.DeliveryLocation)
- .Include(o => o.Pizzas).ThenInclude(p => p.Special)
- .Include(o => o.Pizzas).ThenInclude(p => p.Toppings).ThenInclude(t => t.Topping)
- .OrderByDescending(o => o.CreatedTime)
- .ToListAsync();
-
- return orders.Select(o => OrderWithStatus.FromOrder(o)).ToList();
- }
-
- [HttpGet("{orderId}")]
- public async Task> GetOrderWithStatus(int orderId)
- {
- var order = await _db.Orders
- .Where(o => o.OrderId == orderId)
- // .Where(o => o.UserId == GetUserId())
- .Include(o => o.DeliveryLocation)
- .Include(o => o.Pizzas).ThenInclude(p => p.Special)
- .Include(o => o.Pizzas).ThenInclude(p => p.Toppings).ThenInclude(t => t.Topping)
- .SingleOrDefaultAsync();
-
- if (order == null)
- {
- return NotFound();
- }
-
- return OrderWithStatus.FromOrder(order);
- }
-
- [HttpPost]
- public async Task> PlaceOrder(Order order)
- {
- order.CreatedTime = DateTime.Now;
- order.DeliveryLocation = new LatLong(51.5001, -0.1239);
- // order.UserId = GetUserId();
-
- // Enforce existence of Pizza.SpecialId and Topping.ToppingId
- // in the database - prevent the submitter from making up
- // new specials and toppings
- foreach (var pizza in order.Pizzas)
- {
- pizza.SpecialId = pizza.Special.Id;
- pizza.Special = null;
-
- foreach (var topping in pizza.Toppings)
- {
- topping.ToppingId = topping.Topping.Id;
- topping.Topping = null;
- }
- }
-
- _db.Orders.Attach(order);
- await _db.SaveChangesAsync();
-
- // In the background, send push notifications if possible
- var subscription = await _db.NotificationSubscriptions.Where(e => e.UserId == GetUserId()).SingleOrDefaultAsync();
- if (subscription != null)
- {
- _ = TrackAndSendNotificationsAsync(order, subscription);
- }
-
- return order.OrderId;
- }
-
- private string GetUserId()
- {
- return HttpContext.User.FindFirstValue(ClaimTypes.NameIdentifier);
- }
-
- private static async Task TrackAndSendNotificationsAsync(Order order, NotificationSubscription subscription)
- {
- // In a realistic case, some other backend process would track
- // order delivery progress and send us notifications when it
- // changes. Since we don't have any such process here, fake it.
- await Task.Delay(OrderWithStatus.PreparationDuration);
- await SendNotificationAsync(order, subscription, "Your order has been dispatched!");
-
- await Task.Delay(OrderWithStatus.DeliveryDuration);
- await SendNotificationAsync(order, subscription, "Your order is now delivered. Enjoy!");
- }
-
- private static Task SendNotificationAsync(Order order, NotificationSubscription subscription, string message)
- {
- // This will be implemented later
- return Task.CompletedTask;
- }
- }
-}
+ private readonly PizzaStoreContext _db;
+
+ public OrdersController(PizzaStoreContext db)
+ {
+ _db = db;
+ }
+
+ [HttpGet]
+ public async Task>> GetOrders()
+ {
+ var orders = await _db.Orders
+ // .Where(o => o.UserId == GetUserId())
+ .Include(o => o.DeliveryLocation)
+ .Include(o => o.Pizzas).ThenInclude(p => p.Special)
+ .Include(o => o.Pizzas).ThenInclude(p => p.Toppings).ThenInclude(t => t.Topping)
+ .OrderByDescending(o => o.CreatedTime)
+ .ToListAsync();
+
+ return orders.Select(o => OrderWithStatus.FromOrder(o)).ToList();
+ }
+
+ [HttpGet("{orderId}")]
+ public async Task> GetOrderWithStatus(int orderId)
+ {
+ var order = await _db.Orders
+ .Where(o => o.OrderId == orderId)
+ // .Where(o => o.UserId == GetUserId())
+ .Include(o => o.DeliveryLocation)
+ .Include(o => o.Pizzas).ThenInclude(p => p.Special)
+ .Include(o => o.Pizzas).ThenInclude(p => p.Toppings).ThenInclude(t => t.Topping)
+ .SingleOrDefaultAsync();
+
+ if (order == null)
+ {
+ return NotFound();
+ }
+
+ return OrderWithStatus.FromOrder(order);
+ }
+
+ [HttpPost]
+ public async Task> PlaceOrder(Order order)
+ {
+ order.CreatedTime = DateTime.Now;
+ order.DeliveryLocation = new LatLong(51.5001, -0.1239);
+ // order.UserId = GetUserId();
+
+ // Enforce existence of Pizza.SpecialId and Topping.ToppingId
+ // in the database - prevent the submitter from making up
+ // new specials and toppings
+ foreach (var pizza in order.Pizzas)
+ {
+ pizza.SpecialId = pizza.Special.Id;
+ pizza.Special = null;
+
+ foreach (var topping in pizza.Toppings)
+ {
+ topping.ToppingId = topping.Topping.Id;
+ topping.Topping = null;
+ }
+ }
+
+ _db.Orders.Attach(order);
+ await _db.SaveChangesAsync();
+
+ // In the background, send push notifications if possible
+ var subscription = await _db.NotificationSubscriptions.Where(e => e.UserId == GetUserId()).SingleOrDefaultAsync();
+ if (subscription != null)
+ {
+ _ = TrackAndSendNotificationsAsync(order, subscription);
+ }
+
+ return order.OrderId;
+ }
+
+ private string GetUserId()
+ {
+ return HttpContext.User.FindFirstValue(ClaimTypes.NameIdentifier);
+ }
+
+ private static async Task TrackAndSendNotificationsAsync(Order order, NotificationSubscription subscription)
+ {
+ // In a realistic case, some other backend process would track
+ // order delivery progress and send us notifications when it
+ // changes. Since we don't have any such process here, fake it.
+ await Task.Delay(OrderWithStatus.PreparationDuration);
+ await SendNotificationAsync(order, subscription, "Your order has been dispatched!");
+
+ await Task.Delay(OrderWithStatus.DeliveryDuration);
+ await SendNotificationAsync(order, subscription, "Your order is now delivered. Enjoy!");
+ }
+
+ private static Task SendNotificationAsync(Order order, NotificationSubscription subscription, string message)
+ {
+ // This will be implemented later
+ return Task.CompletedTask;
+ }
+}
\ No newline at end of file
diff --git a/save-points/00-get-started/BlazingPizza.Server/PizzaApiExtensions.cs b/save-points/00-get-started/BlazingPizza.Server/PizzaApiExtensions.cs
new file mode 100644
index 00000000..bf6b7bde
--- /dev/null
+++ b/save-points/00-get-started/BlazingPizza.Server/PizzaApiExtensions.cs
@@ -0,0 +1,60 @@
+using System.Security.Claims;
+using Microsoft.AspNetCore.Authorization;
+using Microsoft.EntityFrameworkCore;
+
+namespace BlazingPizza.Server;
+
+public static class PizzaApiExtensions
+{
+
+ public static WebApplication MapPizzaApi(this WebApplication app)
+ {
+
+ // Subscribe to notifications
+ app.MapPut("/notifications/subscribe", [Authorize] async (
+ HttpContext context,
+ PizzaStoreContext db,
+ NotificationSubscription subscription) =>
+ {
+
+ // We're storing at most one subscription per user, so delete old ones.
+ // Alternatively, you could let the user register multiple subscriptions from different browsers/devices.
+ var userId = GetUserId(context);
+ var oldSubscriptions = db.NotificationSubscriptions.Where(e => e.UserId == userId);
+ db.NotificationSubscriptions.RemoveRange(oldSubscriptions);
+
+ // Store new subscription
+ subscription.UserId = userId;
+ db.NotificationSubscriptions.Attach(subscription);
+
+ await db.SaveChangesAsync();
+ return Results.Ok(subscription);
+
+ });
+
+ // Specials
+ app.MapGet("/specials", async (PizzaStoreContext db) =>
+ {
+
+ var specials = await db.Specials.ToListAsync();
+ return Results.Ok(specials);
+
+ });
+
+ // Toppings
+ app.MapGet("/toppings", async (PizzaStoreContext db) =>
+ {
+ var toppings = await db.Toppings.OrderBy(t => t.Name).ToListAsync();
+ return Results.Ok(toppings);
+ });
+
+ return app;
+
+ }
+
+ private static string GetUserId(HttpContext context)
+ {
+ return context.User.FindFirstValue(ClaimTypes.NameIdentifier);
+ }
+
+}
\ No newline at end of file
diff --git a/save-points/00-get-started/BlazingPizza.Server/PizzaStoreContext.cs b/save-points/00-get-started/BlazingPizza.Server/PizzaStoreContext.cs
index fae5acb4..921b2824 100644
--- a/save-points/00-get-started/BlazingPizza.Server/PizzaStoreContext.cs
+++ b/save-points/00-get-started/BlazingPizza.Server/PizzaStoreContext.cs
@@ -1,39 +1,38 @@
-using IDuende.IdentityServerEEntityFramework.Options
+using Duende.IdentityServer.EntityFramework.Options;
using Microsoft.AspNetCore.ApiAuthorization.IdentityServer;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Options;
-namespace BlazingPizza.Server
+namespace BlazingPizza.Server;
+
+public class PizzaStoreContext : ApiAuthorizationDbContext
{
- public class PizzaStoreContext : ApiAuthorizationDbContext
- {
- public PizzaStoreContext(
- DbContextOptions options,
- IOptions operationalStoreOptions) : base(options, operationalStoreOptions)
- {
- }
+ public PizzaStoreContext(
+ DbContextOptions options,
+ IOptions operationalStoreOptions) : base(options, operationalStoreOptions)
+ {
+ }
- public DbSet Orders { get; set; }
+ public DbSet Orders { get; set; }
- public DbSet Pizzas { get; set; }
+ public DbSet Pizzas { get; set; }
- public DbSet Specials { get; set; }
+ public DbSet Specials { get; set; }
- public DbSet Toppings { get; set; }
+ public DbSet Toppings { get; set; }
- public DbSet NotificationSubscriptions { get; set; }
+ public DbSet NotificationSubscriptions { get; set; }
- protected override void OnModelCreating(ModelBuilder modelBuilder)
- {
- base.OnModelCreating(modelBuilder);
+ protected override void OnModelCreating(ModelBuilder modelBuilder)
+ {
+ base.OnModelCreating(modelBuilder);
- // Configuring a many-to-many special -> topping relationship that is friendly for serialization
- modelBuilder.Entity().HasKey(pst => new { pst.PizzaId, pst.ToppingId });
- modelBuilder.Entity().HasOne().WithMany(ps => ps.Toppings);
- modelBuilder.Entity().HasOne(pst => pst.Topping).WithMany();
+ // Configuring a many-to-many special -> topping relationship that is friendly for serialization
+ modelBuilder.Entity().HasKey(pst => new { pst.PizzaId, pst.ToppingId });
+ modelBuilder.Entity().HasOne().WithMany(ps => ps.Toppings);
+ modelBuilder.Entity().HasOne(pst => pst.Topping).WithMany();
- // Inline the Lat-Long pairs in Order rather than having a FK to another table
- modelBuilder.Entity().OwnsOne(o => o.DeliveryLocation);
- }
- }
+ // Inline the Lat-Long pairs in Order rather than having a FK to another table
+ modelBuilder.Entity().OwnsOne(o => o.DeliveryLocation);
+ }
}
\ No newline at end of file
diff --git a/save-points/00-get-started/BlazingPizza.Server/PizzasController.cs b/save-points/00-get-started/BlazingPizza.Server/PizzasController.cs
deleted file mode 100644
index c082552c..00000000
--- a/save-points/00-get-started/BlazingPizza.Server/PizzasController.cs
+++ /dev/null
@@ -1,16 +0,0 @@
-using Microsoft.AspNetCore.Mvc;
-
-namespace BlazingPizza.Server
-{
- [Route("pizzas")]
- [ApiController]
- public class PizzasController : Controller
- {
- private readonly PizzaStoreContext _db;
-
- public PizzasController(PizzaStoreContext db)
- {
- _db = db;
- }
- }
-}
diff --git a/save-points/00-get-started/BlazingPizza.Server/Program.cs b/save-points/00-get-started/BlazingPizza.Server/Program.cs
index 40a47641..3fe5d78f 100644
--- a/save-points/00-get-started/BlazingPizza.Server/Program.cs
+++ b/save-points/00-get-started/BlazingPizza.Server/Program.cs
@@ -1,33 +1,66 @@
-using Microsoft.AspNetCore.Hosting;
-using Microsoft.Extensions.DependencyInjection;
-using Microsoft.Extensions.Hosting;
+using Microsoft.AspNetCore.Authentication;
+using Microsoft.EntityFrameworkCore;
+using BlazingPizza.Server;
-namespace BlazingPizza.Server
+var builder = WebApplication.CreateBuilder(args);
+
+builder.Services.AddControllersWithViews()
+ .AddJsonOptions(options => {
+ options.JsonSerializerOptions.AddContext();
+ });
+builder.Services.AddRazorPages();
+
+builder.Services.AddDbContext(options =>
+ options.UseSqlite("Data Source=pizza.db"));
+
+builder.Services.AddDefaultIdentity(options => options.SignIn.RequireConfirmedAccount = true)
+ .AddEntityFrameworkStores();
+
+builder.Services.AddIdentityServer()
+ .AddApiAuthorization();
+
+builder.Services.AddAuthentication()
+ .AddIdentityServerJwt();
+
+var app = builder.Build();
+
+// Initialize the database
+var scopeFactory = app.Services.GetRequiredService();
+using (var scope = scopeFactory.CreateScope())
+{
+ var db = scope.ServiceProvider.GetRequiredService();
+ if (db.Database.EnsureCreated())
+ {
+ SeedData.Initialize(db);
+ }
+}
+
+// Configure the HTTP request pipeline.
+if (app.Environment.IsDevelopment())
+{
+ app.UseWebAssemblyDebugging();
+}
+else
{
- public class Program
- {
- public static void Main(string[] args)
- {
- var host = CreateHostBuilder(args).Build();
-
- // Initialize the database
- var scopeFactory = host.Services.GetRequiredService();
- using (var scope = scopeFactory.CreateScope())
- {
- var db = scope.ServiceProvider.GetRequiredService();
- if (db.Database.EnsureCreated())
- {
- SeedData.Initialize(db);
- }
- }
-
- host.Run();
- }
- public static IHostBuilder CreateHostBuilder(string[] args) =>
- Host.CreateDefaultBuilder(args)
- .ConfigureWebHostDefaults(webBuilder =>
- {
- webBuilder.UseStartup();
- });
- }
+ 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.UseBlazorFrameworkFiles();
+app.UseStaticFiles();
+
+app.UseRouting();
+
+app.UseAuthentication();
+app.UseIdentityServer();
+app.UseAuthorization();
+
+app.MapPizzaApi();
+
+app.MapRazorPages();
+app.MapControllers();
+app.MapFallbackToFile("index.html");
+
+app.Run();
\ No newline at end of file
diff --git a/save-points/00-get-started/BlazingPizza.Server/SeedData.cs b/save-points/00-get-started/BlazingPizza.Server/SeedData.cs
index 7c86a5b2..a1e47973 100644
--- a/save-points/00-get-started/BlazingPizza.Server/SeedData.cs
+++ b/save-points/00-get-started/BlazingPizza.Server/SeedData.cs
@@ -1,193 +1,192 @@
-namespace BlazingPizza.Server
+namespace BlazingPizza.Server;
+
+public static class SeedData
{
- public static class SeedData
- {
- public static void Initialize(PizzaStoreContext db)
- {
- var toppings = new Topping[]
- {
- new Topping()
- {
- Name = "Extra cheese",
- Price = 2.50m,
- },
- new Topping()
- {
- Name = "American bacon",
- Price = 2.99m,
- },
- new Topping()
- {
- Name = "British bacon",
- Price = 2.99m,
- },
- new Topping()
- {
- Name = "Canadian bacon",
- Price = 2.99m,
- },
- new Topping()
- {
- Name = "Tea and crumpets",
- Price = 5.00m
- },
- new Topping()
- {
- Name = "Fresh-baked scones",
- Price = 4.50m,
- },
- new Topping()
- {
- Name = "Bell peppers",
- Price = 1.00m,
- },
- new Topping()
- {
- Name = "Onions",
- Price = 1.00m,
- },
- new Topping()
- {
- Name = "Mushrooms",
- Price = 1.00m,
- },
- new Topping()
- {
- Name = "Pepperoni",
- Price = 1.00m,
- },
- new Topping()
- {
- Name = "Duck sausage",
- Price = 3.20m,
- },
- new Topping()
- {
- Name = "Venison meatballs",
- Price = 2.50m,
- },
- new Topping()
- {
- Name = "Served on a silver platter",
- Price = 250.99m,
- },
- new Topping()
- {
- Name = "Lobster on top",
- Price = 64.50m,
- },
- new Topping()
- {
- Name = "Sturgeon caviar",
- Price = 101.75m,
- },
- new Topping()
- {
- Name = "Artichoke hearts",
- Price = 3.40m,
- },
- new Topping()
- {
- Name = "Fresh tomatoes",
- Price = 1.50m,
- },
- new Topping()
- {
- Name = "Basil",
- Price = 1.50m,
- },
- new Topping()
- {
- Name = "Steak (medium-rare)",
- Price = 8.50m,
- },
- new Topping()
- {
- Name = "Blazing hot peppers",
- Price = 4.20m,
- },
- new Topping()
- {
- Name = "Buffalo chicken",
- Price = 5.00m,
- },
- new Topping()
- {
- Name = "Blue cheese",
- Price = 2.50m,
- },
- };
+ public static void Initialize(PizzaStoreContext db)
+ {
+ var toppings = new Topping[]
+ {
+ new Topping()
+ {
+ Name = "Extra cheese",
+ Price = 2.50m,
+ },
+ new Topping()
+ {
+ Name = "American bacon",
+ Price = 2.99m,
+ },
+ new Topping()
+ {
+ Name = "British bacon",
+ Price = 2.99m,
+ },
+ new Topping()
+ {
+ Name = "Canadian bacon",
+ Price = 2.99m,
+ },
+ new Topping()
+ {
+ Name = "Tea and crumpets",
+ Price = 5.00m
+ },
+ new Topping()
+ {
+ Name = "Fresh-baked scones",
+ Price = 4.50m,
+ },
+ new Topping()
+ {
+ Name = "Bell peppers",
+ Price = 1.00m,
+ },
+ new Topping()
+ {
+ Name = "Onions",
+ Price = 1.00m,
+ },
+ new Topping()
+ {
+ Name = "Mushrooms",
+ Price = 1.00m,
+ },
+ new Topping()
+ {
+ Name = "Pepperoni",
+ Price = 1.00m,
+ },
+ new Topping()
+ {
+ Name = "Duck sausage",
+ Price = 3.20m,
+ },
+ new Topping()
+ {
+ Name = "Venison meatballs",
+ Price = 2.50m,
+ },
+ new Topping()
+ {
+ Name = "Served on a silver platter",
+ Price = 250.99m,
+ },
+ new Topping()
+ {
+ Name = "Lobster on top",
+ Price = 64.50m,
+ },
+ new Topping()
+ {
+ Name = "Sturgeon caviar",
+ Price = 101.75m,
+ },
+ new Topping()
+ {
+ Name = "Artichoke hearts",
+ Price = 3.40m,
+ },
+ new Topping()
+ {
+ Name = "Fresh tomatoes",
+ Price = 1.50m,
+ },
+ new Topping()
+ {
+ Name = "Basil",
+ Price = 1.50m,
+ },
+ new Topping()
+ {
+ Name = "Steak (medium-rare)",
+ Price = 8.50m,
+ },
+ new Topping()
+ {
+ Name = "Blazing hot peppers",
+ Price = 4.20m,
+ },
+ new Topping()
+ {
+ Name = "Buffalo chicken",
+ Price = 5.00m,
+ },
+ new Topping()
+ {
+ Name = "Blue cheese",
+ Price = 2.50m,
+ },
+ };
- var specials = new PizzaSpecial[]
- {
- new PizzaSpecial()
- {
- Name = "Basic Cheese Pizza",
- Description = "It's cheesy and delicious. Why wouldn't you want one?",
- BasePrice = 9.99m,
- ImageUrl = "img/pizzas/cheese.jpg",
- },
- new PizzaSpecial()
- {
- Id = 2,
- Name = "The Baconatorizor",
- Description = "It has EVERY kind of bacon",
- BasePrice = 11.99m,
- ImageUrl = "img/pizzas/bacon.jpg",
- },
- new PizzaSpecial()
- {
- Id = 3,
- Name = "Classic pepperoni",
- Description = "It's the pizza you grew up with, but Blazing hot!",
- BasePrice = 10.50m,
- ImageUrl = "img/pizzas/pepperoni.jpg",
- },
- new PizzaSpecial()
- {
- Id = 4,
- Name = "Buffalo chicken",
- Description = "Spicy chicken, hot sauce and bleu cheese, guaranteed to warm you up",
- BasePrice = 12.75m,
- ImageUrl = "img/pizzas/meaty.jpg",
- },
- new PizzaSpecial()
- {
- Id = 5,
- Name = "Mushroom Lovers",
- Description = "It has mushrooms. Isn't that obvious?",
- BasePrice = 11.00m,
- ImageUrl = "img/pizzas/mushroom.jpg",
- },
- new PizzaSpecial()
- {
- Id = 6,
- Name = "The Brit",
- Description = "When in London...",
- BasePrice = 10.25m,
- ImageUrl = "img/pizzas/brit.jpg",
- },
- new PizzaSpecial()
- {
- Id = 7,
- Name = "Veggie Delight",
- Description = "It's like salad, but on a pizza",
- BasePrice = 11.50m,
- ImageUrl = "img/pizzas/salad.jpg",
- },
- new PizzaSpecial()
- {
- Id = 8,
- Name = "Margherita",
- Description = "Traditional Italian pizza with tomatoes and basil",
- BasePrice = 9.99m,
- ImageUrl = "img/pizzas/margherita.jpg",
- },
- };
+ var specials = new PizzaSpecial[]
+ {
+ new PizzaSpecial()
+ {
+ Name = "Basic Cheese Pizza",
+ Description = "It's cheesy and delicious. Why wouldn't you want one?",
+ BasePrice = 9.99m,
+ ImageUrl = "img/pizzas/cheese.jpg",
+ },
+ new PizzaSpecial()
+ {
+ Id = 2,
+ Name = "The Baconatorizor",
+ Description = "It has EVERY kind of bacon",
+ BasePrice = 11.99m,
+ ImageUrl = "img/pizzas/bacon.jpg",
+ },
+ new PizzaSpecial()
+ {
+ Id = 3,
+ Name = "Classic pepperoni",
+ Description = "It's the pizza you grew up with, but Blazing hot!",
+ BasePrice = 10.50m,
+ ImageUrl = "img/pizzas/pepperoni.jpg",
+ },
+ new PizzaSpecial()
+ {
+ Id = 4,
+ Name = "Buffalo chicken",
+ Description = "Spicy chicken, hot sauce and bleu cheese, guaranteed to warm you up",
+ BasePrice = 12.75m,
+ ImageUrl = "img/pizzas/meaty.jpg",
+ },
+ new PizzaSpecial()
+ {
+ Id = 5,
+ Name = "Mushroom Lovers",
+ Description = "It has mushrooms. Isn't that obvious?",
+ BasePrice = 11.00m,
+ ImageUrl = "img/pizzas/mushroom.jpg",
+ },
+ new PizzaSpecial()
+ {
+ Id = 6,
+ Name = "The Brit",
+ Description = "When in London...",
+ BasePrice = 10.25m,
+ ImageUrl = "img/pizzas/brit.jpg",
+ },
+ new PizzaSpecial()
+ {
+ Id = 7,
+ Name = "Veggie Delight",
+ Description = "It's like salad, but on a pizza",
+ BasePrice = 11.50m,
+ ImageUrl = "img/pizzas/salad.jpg",
+ },
+ new PizzaSpecial()
+ {
+ Id = 8,
+ Name = "Margherita",
+ Description = "Traditional Italian pizza with tomatoes and basil",
+ BasePrice = 9.99m,
+ ImageUrl = "img/pizzas/margherita.jpg",
+ },
+ };
- db.Toppings.AddRange(toppings);
- db.Specials.AddRange(specials);
- db.SaveChanges();
- }
- }
-}
+ db.Toppings.AddRange(toppings);
+ db.Specials.AddRange(specials);
+ db.SaveChanges();
+ }
+}
\ No newline at end of file
diff --git a/save-points/00-get-started/BlazingPizza.Server/SpecialsController.cs b/save-points/00-get-started/BlazingPizza.Server/SpecialsController.cs
deleted file mode 100644
index a176844c..00000000
--- a/save-points/00-get-started/BlazingPizza.Server/SpecialsController.cs
+++ /dev/null
@@ -1,26 +0,0 @@
-using System.Collections.Generic;
-using System.Linq;
-using System.Threading.Tasks;
-using Microsoft.AspNetCore.Mvc;
-using Microsoft.EntityFrameworkCore;
-
-namespace BlazingPizza.Server
-{
- [Route("specials")]
- [ApiController]
- public class SpecialsController : Controller
- {
- private readonly PizzaStoreContext _db;
-
- public SpecialsController(PizzaStoreContext db)
- {
- _db = db;
- }
-
- [HttpGet]
- public async Task>> GetSpecials()
- {
- return (await _db.Specials.ToListAsync()).OrderByDescending(s => s.BasePrice).ToList();
- }
- }
-}
diff --git a/save-points/00-get-started/BlazingPizza.Server/Startup.cs b/save-points/00-get-started/BlazingPizza.Server/Startup.cs
deleted file mode 100644
index ed3fca06..00000000
--- a/save-points/00-get-started/BlazingPizza.Server/Startup.cs
+++ /dev/null
@@ -1,70 +0,0 @@
-using Microsoft.AspNetCore.Authentication;
-using Microsoft.AspNetCore.Builder;
-using Microsoft.AspNetCore.Hosting;
-using Microsoft.EntityFrameworkCore;
-using Microsoft.Extensions.Configuration;
-using Microsoft.Extensions.DependencyInjection;
-using Microsoft.Extensions.Hosting;
-
-namespace BlazingPizza.Server
-{
- public class Startup
- {
- public Startup(IConfiguration configuration)
- {
- Configuration = configuration;
- }
-
- public IConfiguration Configuration { get; }
-
- public void ConfigureServices(IServiceCollection services)
- {
- services.AddControllersWithViews();
- services.AddRazorPages();
-
- services.AddDbContext(options =>
- options.UseSqlite("Data Source=pizza.db"));
-
- services.AddDefaultIdentity(options => options.SignIn.RequireConfirmedAccount = true)
- .AddEntityFrameworkStores();
-
- services.AddIdentityServer()
- .AddApiAuthorization();
-
- services.AddAuthentication()
- .AddIdentityServerJwt();
- }
-
- public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
- {
- if (env.IsDevelopment())
- {
- app.UseDeveloperExceptionPage();
- app.UseWebAssemblyDebugging();
- }
- 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.UseBlazorFrameworkFiles();
- app.UseStaticFiles();
-
- app.UseRouting();
-
- app.UseAuthentication();
- app.UseIdentityServer();
- app.UseAuthorization();
-
- app.UseEndpoints(endpoints =>
- {
- endpoints.MapControllers();
- endpoints.MapRazorPages();
- endpoints.MapFallbackToFile("index.html");
- });
- }
- }
-}
\ No newline at end of file
diff --git a/save-points/00-get-started/BlazingPizza.Server/ToppingsController.cs b/save-points/00-get-started/BlazingPizza.Server/ToppingsController.cs
deleted file mode 100644
index 6a677639..00000000
--- a/save-points/00-get-started/BlazingPizza.Server/ToppingsController.cs
+++ /dev/null
@@ -1,26 +0,0 @@
-using System.Collections.Generic;
-using System.Linq;
-using System.Threading.Tasks;
-using Microsoft.AspNetCore.Mvc;
-using Microsoft.EntityFrameworkCore;
-
-namespace BlazingPizza.Server
-{
- [Route("toppings")]
- [ApiController]
- public class ToppingsController : Controller
- {
- private readonly PizzaStoreContext _db;
-
- public ToppingsController(PizzaStoreContext db)
- {
- _db = db;
- }
-
- [HttpGet]
- public async Task>> GetToppings()
- {
- return await _db.Toppings.OrderBy(t => t.Name).ToListAsync();
- }
- }
-}
diff --git a/src/BlazingPizza.Client/BlazingPizza.Client.csproj b/src/BlazingPizza.Client/BlazingPizza.Client.csproj
index 168bb22a..44802d79 100644
--- a/src/BlazingPizza.Client/BlazingPizza.Client.csproj
+++ b/src/BlazingPizza.Client/BlazingPizza.Client.csproj
@@ -2,6 +2,7 @@
$(TargetFrameworkVersion)
+ true
diff --git a/src/BlazingPizza.Client/JSRuntimeExtensions.cs b/src/BlazingPizza.Client/JSRuntimeExtensions.cs
index 89da520c..cc242348 100644
--- a/src/BlazingPizza.Client/JSRuntimeExtensions.cs
+++ b/src/BlazingPizza.Client/JSRuntimeExtensions.cs
@@ -1,13 +1,11 @@
using Microsoft.JSInterop;
-using System.Threading.Tasks;
-namespace BlazingPizza.Client
+namespace BlazingPizza.Client;
+
+public static class JSRuntimeExtensions
{
- public static class JSRuntimeExtensions
- {
- public static ValueTask Confirm(this IJSRuntime jsRuntime, string message)
- {
- return jsRuntime.InvokeAsync("confirm", message);
- }
- }
+ public static ValueTask Confirm(this IJSRuntime jsRuntime, string message)
+ {
+ return jsRuntime.InvokeAsync("confirm", message);
+ }
}
diff --git a/src/BlazingPizza.Client/OrderState.cs b/src/BlazingPizza.Client/OrderState.cs
index 5265ae39..4f47979d 100644
--- a/src/BlazingPizza.Client/OrderState.cs
+++ b/src/BlazingPizza.Client/OrderState.cs
@@ -1,55 +1,52 @@
-using System.Collections.Generic;
+namespace BlazingPizza.Client;
-namespace BlazingPizza.Client
+public class OrderState
{
- public class OrderState
- {
- public bool ShowingConfigureDialog { get; private set; }
-
- public Pizza ConfiguringPizza { get; private set; }
-
- public Order Order { get; private set; } = new Order();
-
- public void ShowConfigurePizzaDialog(PizzaSpecial special)
- {
- ConfiguringPizza = new Pizza()
- {
- Special = special,
- SpecialId = special.Id,
- Size = Pizza.DefaultSize,
- Toppings = new List(),
- };
-
- ShowingConfigureDialog = true;
- }
-
- public void CancelConfigurePizzaDialog()
- {
- ConfiguringPizza = null;
- ShowingConfigureDialog = false;
- }
-
- public void ConfirmConfigurePizzaDialog()
- {
- Order.Pizzas.Add(ConfiguringPizza);
- ConfiguringPizza = null;
-
- ShowingConfigureDialog = false;
- }
-
- public void RemoveConfiguredPizza(Pizza pizza)
- {
- Order.Pizzas.Remove(pizza);
- }
-
- public void ResetOrder()
- {
- Order = new Order();
- }
-
- public void ReplaceOrder(Order order)
- {
- Order = order;
- }
- }
+ public bool ShowingConfigureDialog { get; private set; }
+
+ public Pizza ConfiguringPizza { get; private set; }
+
+ public Order Order { get; private set; } = new Order();
+
+ public void ShowConfigurePizzaDialog(PizzaSpecial special)
+ {
+ ConfiguringPizza = new Pizza()
+ {
+ Special = special,
+ SpecialId = special.Id,
+ Size = Pizza.DefaultSize,
+ Toppings = new List(),
+ };
+
+ ShowingConfigureDialog = true;
+ }
+
+ public void CancelConfigurePizzaDialog()
+ {
+ ConfiguringPizza = null;
+ ShowingConfigureDialog = false;
+ }
+
+ public void ConfirmConfigurePizzaDialog()
+ {
+ Order.Pizzas.Add(ConfiguringPizza);
+ ConfiguringPizza = null;
+
+ ShowingConfigureDialog = false;
+ }
+
+ public void RemoveConfiguredPizza(Pizza pizza)
+ {
+ Order.Pizzas.Remove(pizza);
+ }
+
+ public void ResetOrder()
+ {
+ Order = new Order();
+ }
+
+ public void ReplaceOrder(Order order)
+ {
+ Order = order;
+ }
}
diff --git a/src/BlazingPizza.Client/OrdersClient.cs b/src/BlazingPizza.Client/OrdersClient.cs
index 01c63572..e63bd045 100644
--- a/src/BlazingPizza.Client/OrdersClient.cs
+++ b/src/BlazingPizza.Client/OrdersClient.cs
@@ -1,41 +1,36 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Net.Http;
-using System.Net.Http.Json;
-using System.Threading.Tasks;
-
-namespace BlazingPizza.Client
+using System.Net.Http.Json;
+using System.Text.Json;
+
+namespace BlazingPizza.Client;
+
+public class OrdersClient
{
- public class OrdersClient
- {
- private readonly HttpClient httpClient;
+ private readonly HttpClient httpClient;
- public OrdersClient(HttpClient httpClient)
- {
- this.httpClient = httpClient;
- }
+ public OrdersClient(HttpClient httpClient)
+ {
+ this.httpClient = httpClient;
+ }
- public async Task> GetOrders() =>
- await httpClient.GetFromJsonAsync>("orders");
+ public async Task> GetOrders() =>
+ await httpClient.GetFromJsonAsync("orders", OrderContext.Default.ListOrderWithStatus);
- public async Task GetOrder(int orderId) =>
- await httpClient.GetFromJsonAsync($"orders/{orderId}");
+ public async Task GetOrder(int orderId) =>
+ await httpClient.GetFromJsonAsync($"orders/{orderId}", OrderContext.Default.OrderWithStatus);
- public async Task PlaceOrder(Order order)
- {
- var response = await httpClient.PostAsJsonAsync("orders", order);
- response.EnsureSuccessStatusCode();
- var orderId = await response.Content.ReadFromJsonAsync();
- return orderId;
- }
+ public async Task PlaceOrder(Order order)
+ {
+ var response = await httpClient.PostAsJsonAsync("orders", order, OrderContext.Default.Order);
+ response.EnsureSuccessStatusCode();
+ var orderId = await response.Content.ReadFromJsonAsync();
+ return orderId;
+ }
- public async Task SubscribeToNotifications(NotificationSubscription subscription)
- {
- var response = await httpClient.PutAsJsonAsync("notifications/subscribe", subscription);
- response.EnsureSuccessStatusCode();
- }
- }
+ public async Task SubscribeToNotifications(NotificationSubscription subscription)
+ {
+ var response = await httpClient.PutAsJsonAsync("notifications/subscribe", subscription);
+ response.EnsureSuccessStatusCode();
+ }
}
diff --git a/src/BlazingPizza.Client/Pages/Index.razor b/src/BlazingPizza.Client/Pages/Index.razor
index ca5ac084..f8ff79df 100644
--- a/src/BlazingPizza.Client/Pages/Index.razor
+++ b/src/BlazingPizza.Client/Pages/Index.razor
@@ -61,7 +61,7 @@
protected override async Task OnInitializedAsync()
{
- specials = await HttpClient.GetFromJsonAsync>("specials");
+ specials = await HttpClient.GetFromJsonAsync("specials", BlazingPizza.OrderContext.Default.ListPizzaSpecial);
}
async Task RemovePizza(Pizza configuredPizza)
diff --git a/src/BlazingPizza.Client/PizzaAuthenticationState.cs b/src/BlazingPizza.Client/PizzaAuthenticationState.cs
index 3f295928..f5bfef65 100644
--- a/src/BlazingPizza.Client/PizzaAuthenticationState.cs
+++ b/src/BlazingPizza.Client/PizzaAuthenticationState.cs
@@ -1,9 +1,8 @@
using Microsoft.AspNetCore.Components.WebAssembly.Authentication;
-namespace BlazingPizza.Client
+namespace BlazingPizza.Client;
+
+public class PizzaAuthenticationState : RemoteAuthenticationState
{
- public class PizzaAuthenticationState : RemoteAuthenticationState
- {
- public Order Order { get; set; }
- }
+ public Order Order { get; set; }
}
diff --git a/src/BlazingPizza.Client/Program.cs b/src/BlazingPizza.Client/Program.cs
index afeee128..41eedccb 100644
--- a/src/BlazingPizza.Client/Program.cs
+++ b/src/BlazingPizza.Client/Program.cs
@@ -1,31 +1,20 @@
using Microsoft.AspNetCore.Components.WebAssembly.Authentication;
using Microsoft.AspNetCore.Components.WebAssembly.Hosting;
using Microsoft.Extensions.DependencyInjection;
-using System;
-using System.Net.Http;
-using System.Threading.Tasks;
+using BlazingPizza.Client;
-namespace BlazingPizza.Client
-{
- public class Program
- {
- public static async Task Main(string[] args)
- {
- var builder = WebAssemblyHostBuilder.CreateDefault(args);
- builder.RootComponents.Add("#app");
+var builder = WebAssemblyHostBuilder.CreateDefault(args);
+builder.RootComponents.Add("#app");
- builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri(builder.HostEnvironment.BaseAddress) });
- builder.Services.AddHttpClient(client => client.BaseAddress = new Uri(builder.HostEnvironment.BaseAddress))
- .AddHttpMessageHandler();
- builder.Services.AddScoped();
+builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri(builder.HostEnvironment.BaseAddress) });
+builder.Services.AddHttpClient(client => client.BaseAddress = new Uri(builder.HostEnvironment.BaseAddress))
+ .AddHttpMessageHandler();
+builder.Services.AddScoped();
- // Add auth services
- builder.Services.AddApiAuthorization(options =>
- {
- options.AuthenticationPaths.LogOutSucceededPath = "";
- });
+// Add auth services
+builder.Services.AddApiAuthorization(options =>
+{
+ options.AuthenticationPaths.LogOutSucceededPath = "";
+});
- await builder.Build().RunAsync();
- }
- }
-}
+await builder.Build().RunAsync();
diff --git a/src/BlazingPizza.Client/Shared/ConfigurePizzaDialog.razor b/src/BlazingPizza.Client/Shared/ConfigurePizzaDialog.razor
index 67096b01..f10c7990 100644
--- a/src/BlazingPizza.Client/Shared/ConfigurePizzaDialog.razor
+++ b/src/BlazingPizza.Client/Shared/ConfigurePizzaDialog.razor
@@ -65,7 +65,7 @@
protected async override Task OnInitializedAsync()
{
- toppings = await HttpClient.GetFromJsonAsync>("toppings");
+ toppings = await HttpClient.GetFromJsonAsync("toppings", BlazingPizza.OrderContext.Default.ListTopping);
}
void ToppingSelected(ChangeEventArgs e)
diff --git a/src/BlazingPizza.ComponentsLibrary/BlazingPizza.ComponentsLibrary.csproj b/src/BlazingPizza.ComponentsLibrary/BlazingPizza.ComponentsLibrary.csproj
index 61ebf623..cb996b1b 100644
--- a/src/BlazingPizza.ComponentsLibrary/BlazingPizza.ComponentsLibrary.csproj
+++ b/src/BlazingPizza.ComponentsLibrary/BlazingPizza.ComponentsLibrary.csproj
@@ -2,6 +2,7 @@
$(TargetFrameworkVersion)
+ true
diff --git a/src/BlazingPizza.ComponentsLibrary/LocalStorage.cs b/src/BlazingPizza.ComponentsLibrary/LocalStorage.cs
index f36b098e..bb84f13c 100644
--- a/src/BlazingPizza.ComponentsLibrary/LocalStorage.cs
+++ b/src/BlazingPizza.ComponentsLibrary/LocalStorage.cs
@@ -1,17 +1,15 @@
using Microsoft.JSInterop;
-using System.Threading.Tasks;
-namespace BlazingPizza.ComponentsLibrary
+namespace BlazingPizza.ComponentsLibrary;
+
+public static class LocalStorage
{
- public static class LocalStorage
- {
- public static ValueTask GetAsync(IJSRuntime jsRuntime, string key)
- => jsRuntime.InvokeAsync("blazorLocalStorage.get", key);
+ public static ValueTask GetAsync(IJSRuntime jsRuntime, string key)
+ => jsRuntime.InvokeAsync("blazorLocalStorage.get", key);
- public static ValueTask SetAsync(IJSRuntime jsRuntime, string key, object value)
- => jsRuntime.InvokeVoidAsync("blazorLocalStorage.set", key, value);
+ public static ValueTask SetAsync(IJSRuntime jsRuntime, string key, object value)
+ => jsRuntime.InvokeVoidAsync("blazorLocalStorage.set", key, value);
- public static ValueTask DeleteAsync(IJSRuntime jsRuntime, string key)
- => jsRuntime.InvokeVoidAsync("blazorLocalStorage.delete", key);
- }
-}
+ public static ValueTask DeleteAsync(IJSRuntime jsRuntime, string key)
+ => jsRuntime.InvokeVoidAsync("blazorLocalStorage.delete", key);
+}
\ No newline at end of file
diff --git a/src/BlazingPizza.ComponentsLibrary/Map/Marker.cs b/src/BlazingPizza.ComponentsLibrary/Map/Marker.cs
index 63006067..a8e78f2a 100644
--- a/src/BlazingPizza.ComponentsLibrary/Map/Marker.cs
+++ b/src/BlazingPizza.ComponentsLibrary/Map/Marker.cs
@@ -1,13 +1,12 @@
-namespace BlazingPizza.ComponentsLibrary.Map
+namespace BlazingPizza.ComponentsLibrary.Map;
+
+public class Marker
{
- public class Marker
- {
- public string Description { get; set; }
+ public string Description { get; set; }
- public double X { get; set; }
+ public double X { get; set; }
- public double Y { get; set; }
+ public double Y { get; set; }
- public bool ShowPopup { get; set; }
- }
+ public bool ShowPopup { get; set; }
}
diff --git a/src/BlazingPizza.ComponentsLibrary/Map/Point.cs b/src/BlazingPizza.ComponentsLibrary/Map/Point.cs
index 03841826..349046d4 100644
--- a/src/BlazingPizza.ComponentsLibrary/Map/Point.cs
+++ b/src/BlazingPizza.ComponentsLibrary/Map/Point.cs
@@ -1,9 +1,8 @@
-namespace BlazingPizza.ComponentsLibrary.Map
+namespace BlazingPizza.ComponentsLibrary.Map;
+
+public class Point
{
- public class Point
- {
- public double X { get; set; }
+ public double X { get; set; }
- public double Y { get; set; }
- }
-}
+ public double Y { get; set; }
+}
\ No newline at end of file
diff --git a/src/BlazingPizza.Server/BlazingPizza.Server.csproj b/src/BlazingPizza.Server/BlazingPizza.Server.csproj
index e1e7aaef..abd2317b 100644
--- a/src/BlazingPizza.Server/BlazingPizza.Server.csproj
+++ b/src/BlazingPizza.Server/BlazingPizza.Server.csproj
@@ -2,6 +2,7 @@
$(TargetFrameworkVersion)
+ true
diff --git a/src/BlazingPizza.Server/Models/AddressEntityType.cs b/src/BlazingPizza.Server/Models/AddressEntityType.cs
new file mode 100644
index 00000000..82db81b6
--- /dev/null
+++ b/src/BlazingPizza.Server/Models/AddressEntityType.cs
@@ -0,0 +1,92 @@
+//
+using System;
+using System.Reflection;
+using Microsoft.EntityFrameworkCore.Metadata;
+
+#pragma warning disable 219, 612, 618
+#nullable disable
+
+namespace BlazingPizza.Server.Models
+{
+ internal partial class AddressEntityType
+ {
+ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null)
+ {
+ var runtimeEntityType = model.AddEntityType(
+ "BlazingPizza.Address",
+ typeof(Address),
+ baseEntityType);
+
+ var id = runtimeEntityType.AddProperty(
+ "Id",
+ typeof(int),
+ propertyInfo: typeof(Address).GetProperty("Id", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly),
+ fieldInfo: typeof(Address).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly),
+ valueGenerated: ValueGenerated.OnAdd,
+ afterSaveBehavior: PropertySaveBehavior.Throw);
+
+ var city = runtimeEntityType.AddProperty(
+ "City",
+ typeof(string),
+ propertyInfo: typeof(Address).GetProperty("City", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly),
+ fieldInfo: typeof(Address).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly),
+ maxLength: 50);
+
+ var line1 = runtimeEntityType.AddProperty(
+ "Line1",
+ typeof(string),
+ propertyInfo: typeof(Address).GetProperty("Line1", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly),
+ fieldInfo: typeof(Address).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly),
+ maxLength: 100);
+
+ var line2 = runtimeEntityType.AddProperty(
+ "Line2",
+ typeof(string),
+ propertyInfo: typeof(Address).GetProperty("Line2", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly),
+ fieldInfo: typeof(Address).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly),
+ nullable: true,
+ maxLength: 100);
+
+ var name = runtimeEntityType.AddProperty(
+ "Name",
+ typeof(string),
+ propertyInfo: typeof(Address).GetProperty("Name", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly),
+ fieldInfo: typeof(Address).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly),
+ maxLength: 100);
+
+ var postalCode = runtimeEntityType.AddProperty(
+ "PostalCode",
+ typeof(string),
+ propertyInfo: typeof(Address).GetProperty("PostalCode", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly),
+ fieldInfo: typeof(Address).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly),
+ maxLength: 20);
+
+ var region = runtimeEntityType.AddProperty(
+ "Region",
+ typeof(string),
+ propertyInfo: typeof(Address).GetProperty("Region", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly),
+ fieldInfo: typeof(Address).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly),
+ maxLength: 20);
+
+ var key = runtimeEntityType.AddKey(
+ new[] { id });
+ runtimeEntityType.SetPrimaryKey(key);
+
+ return runtimeEntityType;
+ }
+
+ public static void CreateAnnotations(RuntimeEntityType runtimeEntityType)
+ {
+ runtimeEntityType.AddAnnotation("Relational:FunctionName", null);
+ runtimeEntityType.AddAnnotation("Relational:Schema", null);
+ runtimeEntityType.AddAnnotation("Relational:SqlQuery", null);
+ runtimeEntityType.AddAnnotation("Relational:TableName", "Address");
+ runtimeEntityType.AddAnnotation("Relational:ViewName", null);
+ runtimeEntityType.AddAnnotation("Relational:ViewSchema", null);
+
+ Customize(runtimeEntityType);
+ }
+
+ static partial void Customize(RuntimeEntityType runtimeEntityType);
+ }
+}
diff --git a/src/BlazingPizza.Server/Models/DeviceFlowCodesEntityType.cs b/src/BlazingPizza.Server/Models/DeviceFlowCodesEntityType.cs
new file mode 100644
index 00000000..1dd4563b
--- /dev/null
+++ b/src/BlazingPizza.Server/Models/DeviceFlowCodesEntityType.cs
@@ -0,0 +1,114 @@
+//
+using System;
+using System.Reflection;
+using Duende.IdentityServer.EntityFramework.Entities;
+using Microsoft.EntityFrameworkCore.Metadata;
+
+#pragma warning disable 219, 612, 618
+#nullable disable
+
+namespace BlazingPizza.Server.Models
+{
+ internal partial class DeviceFlowCodesEntityType
+ {
+ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null)
+ {
+ var runtimeEntityType = model.AddEntityType(
+ "Duende.IdentityServer.EntityFramework.Entities.DeviceFlowCodes",
+ typeof(DeviceFlowCodes),
+ baseEntityType);
+
+ var userCode = runtimeEntityType.AddProperty(
+ "UserCode",
+ typeof(string),
+ propertyInfo: typeof(DeviceFlowCodes).GetProperty("UserCode", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly),
+ fieldInfo: typeof(DeviceFlowCodes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly),
+ afterSaveBehavior: PropertySaveBehavior.Throw,
+ maxLength: 200);
+
+ var clientId = runtimeEntityType.AddProperty(
+ "ClientId",
+ typeof(string),
+ propertyInfo: typeof(DeviceFlowCodes).GetProperty("ClientId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly),
+ fieldInfo: typeof(DeviceFlowCodes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly),
+ maxLength: 200);
+
+ var creationTime = runtimeEntityType.AddProperty(
+ "CreationTime",
+ typeof(DateTime),
+ propertyInfo: typeof(DeviceFlowCodes).GetProperty("CreationTime", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly),
+ fieldInfo: typeof(DeviceFlowCodes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly));
+
+ var data = runtimeEntityType.AddProperty(
+ "Data",
+ typeof(string),
+ propertyInfo: typeof(DeviceFlowCodes).GetProperty("Data", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly),
+ fieldInfo: typeof(DeviceFlowCodes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly),
+ maxLength: 50000);
+
+ var description = runtimeEntityType.AddProperty(
+ "Description",
+ typeof(string),
+ propertyInfo: typeof(DeviceFlowCodes).GetProperty("Description", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly),
+ fieldInfo: typeof(DeviceFlowCodes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly),
+ nullable: true,
+ maxLength: 200);
+
+ var deviceCode = runtimeEntityType.AddProperty(
+ "DeviceCode",
+ typeof(string),
+ propertyInfo: typeof(DeviceFlowCodes).GetProperty("DeviceCode", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly),
+ fieldInfo: typeof(DeviceFlowCodes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly),
+ maxLength: 200);
+
+ var expiration = runtimeEntityType.AddProperty(
+ "Expiration",
+ typeof(DateTime?),
+ propertyInfo: typeof(DeviceFlowCodes).GetProperty("Expiration", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly),
+ fieldInfo: typeof(DeviceFlowCodes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly));
+
+ var sessionId = runtimeEntityType.AddProperty(
+ "SessionId",
+ typeof(string),
+ propertyInfo: typeof(DeviceFlowCodes).GetProperty("SessionId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly),
+ fieldInfo: typeof(DeviceFlowCodes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly),
+ nullable: true,
+ maxLength: 100);
+
+ var subjectId = runtimeEntityType.AddProperty(
+ "SubjectId",
+ typeof(string),
+ propertyInfo: typeof(DeviceFlowCodes).GetProperty("SubjectId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly),
+ fieldInfo: typeof(DeviceFlowCodes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly),
+ nullable: true,
+ maxLength: 200);
+
+ var key = runtimeEntityType.AddKey(
+ new[] { userCode });
+ runtimeEntityType.SetPrimaryKey(key);
+
+ var index = runtimeEntityType.AddIndex(
+ new[] { deviceCode },
+ unique: true);
+
+ var index0 = runtimeEntityType.AddIndex(
+ new[] { expiration });
+
+ return runtimeEntityType;
+ }
+
+ public static void CreateAnnotations(RuntimeEntityType runtimeEntityType)
+ {
+ runtimeEntityType.AddAnnotation("Relational:FunctionName", null);
+ runtimeEntityType.AddAnnotation("Relational:Schema", null);
+ runtimeEntityType.AddAnnotation("Relational:SqlQuery", null);
+ runtimeEntityType.AddAnnotation("Relational:TableName", "DeviceCodes");
+ runtimeEntityType.AddAnnotation("Relational:ViewName", null);
+ runtimeEntityType.AddAnnotation("Relational:ViewSchema", null);
+
+ Customize(runtimeEntityType);
+ }
+
+ static partial void Customize(RuntimeEntityType runtimeEntityType);
+ }
+}
diff --git a/src/BlazingPizza.Server/Models/IdentityRoleClaimstringEntityType.cs b/src/BlazingPizza.Server/Models/IdentityRoleClaimstringEntityType.cs
new file mode 100644
index 00000000..8946b261
--- /dev/null
+++ b/src/BlazingPizza.Server/Models/IdentityRoleClaimstringEntityType.cs
@@ -0,0 +1,85 @@
+//
+using System;
+using System.Reflection;
+using Microsoft.AspNetCore.Identity;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Metadata;
+
+#pragma warning disable 219, 612, 618
+#nullable disable
+
+namespace BlazingPizza.Server.Models
+{
+ internal partial class IdentityRoleClaimstringEntityType
+ {
+ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null)
+ {
+ var runtimeEntityType = model.AddEntityType(
+ "Microsoft.AspNetCore.Identity.IdentityRoleClaim",
+ typeof(IdentityRoleClaim),
+ baseEntityType);
+
+ var id = runtimeEntityType.AddProperty(
+ "Id",
+ typeof(int),
+ propertyInfo: typeof(IdentityRoleClaim).GetProperty("Id", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly),
+ fieldInfo: typeof(IdentityRoleClaim).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly),
+ valueGenerated: ValueGenerated.OnAdd,
+ afterSaveBehavior: PropertySaveBehavior.Throw);
+
+ var claimType = runtimeEntityType.AddProperty(
+ "ClaimType",
+ typeof(string),
+ propertyInfo: typeof(IdentityRoleClaim).GetProperty("ClaimType", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly),
+ fieldInfo: typeof(IdentityRoleClaim).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly),
+ nullable: true);
+
+ var claimValue = runtimeEntityType.AddProperty(
+ "ClaimValue",
+ typeof(string),
+ propertyInfo: typeof(IdentityRoleClaim).GetProperty("ClaimValue", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly),
+ fieldInfo: typeof(IdentityRoleClaim).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly),
+ nullable: true);
+
+ var roleId = runtimeEntityType.AddProperty(
+ "RoleId",
+ typeof(string),
+ propertyInfo: typeof(IdentityRoleClaim).GetProperty("RoleId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly),
+ fieldInfo: typeof(IdentityRoleClaim).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly));
+
+ var key = runtimeEntityType.AddKey(
+ new[] { id });
+ runtimeEntityType.SetPrimaryKey(key);
+
+ var index = runtimeEntityType.AddIndex(
+ new[] { roleId });
+
+ return runtimeEntityType;
+ }
+
+ public static RuntimeForeignKey CreateForeignKey1(RuntimeEntityType declaringEntityType, RuntimeEntityType principalEntityType)
+ {
+ var runtimeForeignKey = declaringEntityType.AddForeignKey(new[] { declaringEntityType.FindProperty("RoleId") },
+ principalEntityType.FindKey(new[] { principalEntityType.FindProperty("Id") }),
+ principalEntityType,
+ deleteBehavior: DeleteBehavior.Cascade,
+ required: true);
+
+ return runtimeForeignKey;
+ }
+
+ public static void CreateAnnotations(RuntimeEntityType runtimeEntityType)
+ {
+ runtimeEntityType.AddAnnotation("Relational:FunctionName", null);
+ runtimeEntityType.AddAnnotation("Relational:Schema", null);
+ runtimeEntityType.AddAnnotation("Relational:SqlQuery", null);
+ runtimeEntityType.AddAnnotation("Relational:TableName", "AspNetRoleClaims");
+ runtimeEntityType.AddAnnotation("Relational:ViewName", null);
+ runtimeEntityType.AddAnnotation("Relational:ViewSchema", null);
+
+ Customize(runtimeEntityType);
+ }
+
+ static partial void Customize(RuntimeEntityType runtimeEntityType);
+ }
+}
diff --git a/src/BlazingPizza.Server/Models/IdentityRoleEntityType.cs b/src/BlazingPizza.Server/Models/IdentityRoleEntityType.cs
new file mode 100644
index 00000000..2f1fec2b
--- /dev/null
+++ b/src/BlazingPizza.Server/Models/IdentityRoleEntityType.cs
@@ -0,0 +1,78 @@
+//
+using System;
+using System.Reflection;
+using Microsoft.AspNetCore.Identity;
+using Microsoft.EntityFrameworkCore.Metadata;
+
+#pragma warning disable 219, 612, 618
+#nullable disable
+
+namespace BlazingPizza.Server.Models
+{
+ internal partial class IdentityRoleEntityType
+ {
+ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null)
+ {
+ var runtimeEntityType = model.AddEntityType(
+ "Microsoft.AspNetCore.Identity.IdentityRole",
+ typeof(IdentityRole),
+ baseEntityType);
+
+ var id = runtimeEntityType.AddProperty(
+ "Id",
+ typeof(string),
+ propertyInfo: typeof(IdentityRole).GetProperty("Id", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly),
+ fieldInfo: typeof(IdentityRole).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly),
+ afterSaveBehavior: PropertySaveBehavior.Throw);
+
+ var concurrencyStamp = runtimeEntityType.AddProperty(
+ "ConcurrencyStamp",
+ typeof(string),
+ propertyInfo: typeof(IdentityRole).GetProperty("ConcurrencyStamp", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly),
+ fieldInfo: typeof(IdentityRole).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly),
+ nullable: true,
+ concurrencyToken: true);
+
+ var name = runtimeEntityType.AddProperty(
+ "Name",
+ typeof(string),
+ propertyInfo: typeof(IdentityRole).GetProperty("Name", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly),
+ fieldInfo: typeof(IdentityRole).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly),
+ nullable: true,
+ maxLength: 256);
+
+ var normalizedName = runtimeEntityType.AddProperty(
+ "NormalizedName",
+ typeof(string),
+ propertyInfo: typeof(IdentityRole).GetProperty("NormalizedName", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly),
+ fieldInfo: typeof(IdentityRole).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly),
+ nullable: true,
+ maxLength: 256);
+
+ var key = runtimeEntityType.AddKey(
+ new[] { id });
+ runtimeEntityType.SetPrimaryKey(key);
+
+ var index = runtimeEntityType.AddIndex(
+ new[] { normalizedName },
+ unique: true);
+ index.AddAnnotation("Relational:Name", "RoleNameIndex");
+
+ return runtimeEntityType;
+ }
+
+ public static void CreateAnnotations(RuntimeEntityType runtimeEntityType)
+ {
+ runtimeEntityType.AddAnnotation("Relational:FunctionName", null);
+ runtimeEntityType.AddAnnotation("Relational:Schema", null);
+ runtimeEntityType.AddAnnotation("Relational:SqlQuery", null);
+ runtimeEntityType.AddAnnotation("Relational:TableName", "AspNetRoles");
+ runtimeEntityType.AddAnnotation("Relational:ViewName", null);
+ runtimeEntityType.AddAnnotation("Relational:ViewSchema", null);
+
+ Customize(runtimeEntityType);
+ }
+
+ static partial void Customize(RuntimeEntityType runtimeEntityType);
+ }
+}
diff --git a/src/BlazingPizza.Server/Models/IdentityUserClaimstringEntityType.cs b/src/BlazingPizza.Server/Models/IdentityUserClaimstringEntityType.cs
new file mode 100644
index 00000000..55418a1e
--- /dev/null
+++ b/src/BlazingPizza.Server/Models/IdentityUserClaimstringEntityType.cs
@@ -0,0 +1,85 @@
+//
+using System;
+using System.Reflection;
+using Microsoft.AspNetCore.Identity;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Metadata;
+
+#pragma warning disable 219, 612, 618
+#nullable disable
+
+namespace BlazingPizza.Server.Models
+{
+ internal partial class IdentityUserClaimstringEntityType
+ {
+ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null)
+ {
+ var runtimeEntityType = model.AddEntityType(
+ "Microsoft.AspNetCore.Identity.IdentityUserClaim",
+ typeof(IdentityUserClaim),
+ baseEntityType);
+
+ var id = runtimeEntityType.AddProperty(
+ "Id",
+ typeof(int),
+ propertyInfo: typeof(IdentityUserClaim).GetProperty("Id", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly),
+ fieldInfo: typeof(IdentityUserClaim).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly),
+ valueGenerated: ValueGenerated.OnAdd,
+ afterSaveBehavior: PropertySaveBehavior.Throw);
+
+ var claimType = runtimeEntityType.AddProperty(
+ "ClaimType",
+ typeof(string),
+ propertyInfo: typeof(IdentityUserClaim).GetProperty("ClaimType", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly),
+ fieldInfo: typeof(IdentityUserClaim).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly),
+ nullable: true);
+
+ var claimValue = runtimeEntityType.AddProperty(
+ "ClaimValue",
+ typeof(string),
+ propertyInfo: typeof(IdentityUserClaim).GetProperty("ClaimValue", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly),
+ fieldInfo: typeof(IdentityUserClaim).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly),
+ nullable: true);
+
+ var userId = runtimeEntityType.AddProperty(
+ "UserId",
+ typeof(string),
+ propertyInfo: typeof(IdentityUserClaim).GetProperty("UserId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly),
+ fieldInfo: typeof(IdentityUserClaim).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly));
+
+ var key = runtimeEntityType.AddKey(
+ new[] { id });
+ runtimeEntityType.SetPrimaryKey(key);
+
+ var index = runtimeEntityType.AddIndex(
+ new[] { userId });
+
+ return runtimeEntityType;
+ }
+
+ public static RuntimeForeignKey CreateForeignKey1(RuntimeEntityType declaringEntityType, RuntimeEntityType principalEntityType)
+ {
+ var runtimeForeignKey = declaringEntityType.AddForeignKey(new[] { declaringEntityType.FindProperty("UserId") },
+ principalEntityType.FindKey(new[] { principalEntityType.FindProperty("Id") }),
+ principalEntityType,
+ deleteBehavior: DeleteBehavior.Cascade,
+ required: true);
+
+ return runtimeForeignKey;
+ }
+
+ public static void CreateAnnotations(RuntimeEntityType runtimeEntityType)
+ {
+ runtimeEntityType.AddAnnotation("Relational:FunctionName", null);
+ runtimeEntityType.AddAnnotation("Relational:Schema", null);
+ runtimeEntityType.AddAnnotation("Relational:SqlQuery", null);
+ runtimeEntityType.AddAnnotation("Relational:TableName", "AspNetUserClaims");
+ runtimeEntityType.AddAnnotation("Relational:ViewName", null);
+ runtimeEntityType.AddAnnotation("Relational:ViewSchema", null);
+
+ Customize(runtimeEntityType);
+ }
+
+ static partial void Customize(RuntimeEntityType runtimeEntityType);
+ }
+}
diff --git a/src/BlazingPizza.Server/Models/IdentityUserLoginstringEntityType.cs b/src/BlazingPizza.Server/Models/IdentityUserLoginstringEntityType.cs
new file mode 100644
index 00000000..3ca029bd
--- /dev/null
+++ b/src/BlazingPizza.Server/Models/IdentityUserLoginstringEntityType.cs
@@ -0,0 +1,86 @@
+//
+using System;
+using System.Reflection;
+using Microsoft.AspNetCore.Identity;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Metadata;
+
+#pragma warning disable 219, 612, 618
+#nullable disable
+
+namespace BlazingPizza.Server.Models
+{
+ internal partial class IdentityUserLoginstringEntityType
+ {
+ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null)
+ {
+ var runtimeEntityType = model.AddEntityType(
+ "Microsoft.AspNetCore.Identity.IdentityUserLogin",
+ typeof(IdentityUserLogin),
+ baseEntityType);
+
+ var loginProvider = runtimeEntityType.AddProperty(
+ "LoginProvider",
+ typeof(string),
+ propertyInfo: typeof(IdentityUserLogin).GetProperty("LoginProvider", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly),
+ fieldInfo: typeof(IdentityUserLogin).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly),
+ afterSaveBehavior: PropertySaveBehavior.Throw,
+ maxLength: 128);
+
+ var providerKey = runtimeEntityType.AddProperty(
+ "ProviderKey",
+ typeof(string),
+ propertyInfo: typeof(IdentityUserLogin).GetProperty("ProviderKey", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly),
+ fieldInfo: typeof(IdentityUserLogin).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly),
+ afterSaveBehavior: PropertySaveBehavior.Throw,
+ maxLength: 128);
+
+ var providerDisplayName = runtimeEntityType.AddProperty(
+ "ProviderDisplayName",
+ typeof(string),
+ propertyInfo: typeof(IdentityUserLogin).GetProperty("ProviderDisplayName", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly),
+ fieldInfo: typeof(IdentityUserLogin).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly),
+ nullable: true);
+
+ var userId = runtimeEntityType.AddProperty(
+ "UserId",
+ typeof(string),
+ propertyInfo: typeof(IdentityUserLogin).GetProperty("UserId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly),
+ fieldInfo: typeof(IdentityUserLogin).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly));
+
+ var key = runtimeEntityType.AddKey(
+ new[] { loginProvider, providerKey });
+ runtimeEntityType.SetPrimaryKey(key);
+
+ var index = runtimeEntityType.AddIndex(
+ new[] { userId });
+
+ return runtimeEntityType;
+ }
+
+ public static RuntimeForeignKey CreateForeignKey1(RuntimeEntityType declaringEntityType, RuntimeEntityType principalEntityType)
+ {
+ var runtimeForeignKey = declaringEntityType.AddForeignKey(new[] { declaringEntityType.FindProperty("UserId") },
+ principalEntityType.FindKey(new[] { principalEntityType.FindProperty("Id") }),
+ principalEntityType,
+ deleteBehavior: DeleteBehavior.Cascade,
+ required: true);
+
+ return runtimeForeignKey;
+ }
+
+ public static void CreateAnnotations(RuntimeEntityType runtimeEntityType)
+ {
+ runtimeEntityType.AddAnnotation("Relational:FunctionName", null);
+ runtimeEntityType.AddAnnotation("Relational:Schema", null);
+ runtimeEntityType.AddAnnotation("Relational:SqlQuery", null);
+ runtimeEntityType.AddAnnotation("Relational:TableName", "AspNetUserLogins");
+ runtimeEntityType.AddAnnotation("Relational:ViewName", null);
+ runtimeEntityType.AddAnnotation("Relational:ViewSchema", null);
+
+ Customize(runtimeEntityType);
+ }
+
+ static partial void Customize(RuntimeEntityType runtimeEntityType);
+ }
+}
diff --git a/src/BlazingPizza.Server/Models/IdentityUserRolestringEntityType.cs b/src/BlazingPizza.Server/Models/IdentityUserRolestringEntityType.cs
new file mode 100644
index 00000000..70078d7a
--- /dev/null
+++ b/src/BlazingPizza.Server/Models/IdentityUserRolestringEntityType.cs
@@ -0,0 +1,82 @@
+//
+using System;
+using System.Reflection;
+using Microsoft.AspNetCore.Identity;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Metadata;
+
+#pragma warning disable 219, 612, 618
+#nullable disable
+
+namespace BlazingPizza.Server.Models
+{
+ internal partial class IdentityUserRolestringEntityType
+ {
+ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null)
+ {
+ var runtimeEntityType = model.AddEntityType(
+ "Microsoft.AspNetCore.Identity.IdentityUserRole",
+ typeof(IdentityUserRole),
+ baseEntityType);
+
+ var userId = runtimeEntityType.AddProperty(
+ "UserId",
+ typeof(string),
+ propertyInfo: typeof(IdentityUserRole).GetProperty("UserId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly),
+ fieldInfo: typeof(IdentityUserRole).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly),
+ afterSaveBehavior: PropertySaveBehavior.Throw);
+
+ var roleId = runtimeEntityType.AddProperty(
+ "RoleId",
+ typeof(string),
+ propertyInfo: typeof(IdentityUserRole).GetProperty("RoleId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly),
+ fieldInfo: typeof(IdentityUserRole).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly),
+ afterSaveBehavior: PropertySaveBehavior.Throw);
+
+ var key = runtimeEntityType.AddKey(
+ new[] { userId, roleId });
+ runtimeEntityType.SetPrimaryKey(key);
+
+ var index = runtimeEntityType.AddIndex(
+ new[] { roleId });
+
+ return runtimeEntityType;
+ }
+
+ public static RuntimeForeignKey CreateForeignKey1(RuntimeEntityType declaringEntityType, RuntimeEntityType principalEntityType)
+ {
+ var runtimeForeignKey = declaringEntityType.AddForeignKey(new[] { declaringEntityType.FindProperty("RoleId") },
+ principalEntityType.FindKey(new[] { principalEntityType.FindProperty("Id") }),
+ principalEntityType,
+ deleteBehavior: DeleteBehavior.Cascade,
+ required: true);
+
+ return runtimeForeignKey;
+ }
+
+ public static RuntimeForeignKey CreateForeignKey2(RuntimeEntityType declaringEntityType, RuntimeEntityType principalEntityType)
+ {
+ var runtimeForeignKey = declaringEntityType.AddForeignKey(new[] { declaringEntityType.FindProperty("UserId") },
+ principalEntityType.FindKey(new[] { principalEntityType.FindProperty("Id") }),
+ principalEntityType,
+ deleteBehavior: DeleteBehavior.Cascade,
+ required: true);
+
+ return runtimeForeignKey;
+ }
+
+ public static void CreateAnnotations(RuntimeEntityType runtimeEntityType)
+ {
+ runtimeEntityType.AddAnnotation("Relational:FunctionName", null);
+ runtimeEntityType.AddAnnotation("Relational:Schema", null);
+ runtimeEntityType.AddAnnotation("Relational:SqlQuery", null);
+ runtimeEntityType.AddAnnotation("Relational:TableName", "AspNetUserRoles");
+ runtimeEntityType.AddAnnotation("Relational:ViewName", null);
+ runtimeEntityType.AddAnnotation("Relational:ViewSchema", null);
+
+ Customize(runtimeEntityType);
+ }
+
+ static partial void Customize(RuntimeEntityType runtimeEntityType);
+ }
+}
diff --git a/src/BlazingPizza.Server/Models/IdentityUserTokenstringEntityType.cs b/src/BlazingPizza.Server/Models/IdentityUserTokenstringEntityType.cs
new file mode 100644
index 00000000..93ba6d31
--- /dev/null
+++ b/src/BlazingPizza.Server/Models/IdentityUserTokenstringEntityType.cs
@@ -0,0 +1,84 @@
+//
+using System;
+using System.Reflection;
+using Microsoft.AspNetCore.Identity;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Metadata;
+
+#pragma warning disable 219, 612, 618
+#nullable disable
+
+namespace BlazingPizza.Server.Models
+{
+ internal partial class IdentityUserTokenstringEntityType
+ {
+ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null)
+ {
+ var runtimeEntityType = model.AddEntityType(
+ "Microsoft.AspNetCore.Identity.IdentityUserToken",
+ typeof(IdentityUserToken),
+ baseEntityType);
+
+ var userId = runtimeEntityType.AddProperty(
+ "UserId",
+ typeof(string),
+ propertyInfo: typeof(IdentityUserToken).GetProperty("UserId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly),
+ fieldInfo: typeof(IdentityUserToken).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly),
+ afterSaveBehavior: PropertySaveBehavior.Throw);
+
+ var loginProvider = runtimeEntityType.AddProperty(
+ "LoginProvider",
+ typeof(string),
+ propertyInfo: typeof(IdentityUserToken).GetProperty("LoginProvider", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly),
+ fieldInfo: typeof(IdentityUserToken).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly),
+ afterSaveBehavior: PropertySaveBehavior.Throw,
+ maxLength: 128);
+
+ var name = runtimeEntityType.AddProperty(
+ "Name",
+ typeof(string),
+ propertyInfo: typeof(IdentityUserToken).GetProperty("Name", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly),
+ fieldInfo: typeof(IdentityUserToken).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly),
+ afterSaveBehavior: PropertySaveBehavior.Throw,
+ maxLength: 128);
+
+ var value = runtimeEntityType.AddProperty(
+ "Value",
+ typeof(string),
+ propertyInfo: typeof(IdentityUserToken).GetProperty("Value", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly),
+ fieldInfo: typeof(IdentityUserToken).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly),
+ nullable: true);
+
+ var key = runtimeEntityType.AddKey(
+ new[] { userId, loginProvider, name });
+ runtimeEntityType.SetPrimaryKey(key);
+
+ return runtimeEntityType;
+ }
+
+ public static RuntimeForeignKey CreateForeignKey1(RuntimeEntityType declaringEntityType, RuntimeEntityType principalEntityType)
+ {
+ var runtimeForeignKey = declaringEntityType.AddForeignKey(new[] { declaringEntityType.FindProperty("UserId") },
+ principalEntityType.FindKey(new[] { principalEntityType.FindProperty("Id") }),
+ principalEntityType,
+ deleteBehavior: DeleteBehavior.Cascade,
+ required: true);
+
+ return runtimeForeignKey;
+ }
+
+ public static void CreateAnnotations(RuntimeEntityType runtimeEntityType)
+ {
+ runtimeEntityType.AddAnnotation("Relational:FunctionName", null);
+ runtimeEntityType.AddAnnotation("Relational:Schema", null);
+ runtimeEntityType.AddAnnotation("Relational:SqlQuery", null);
+ runtimeEntityType.AddAnnotation("Relational:TableName", "AspNetUserTokens");
+ runtimeEntityType.AddAnnotation("Relational:ViewName", null);
+ runtimeEntityType.AddAnnotation("Relational:ViewSchema", null);
+
+ Customize(runtimeEntityType);
+ }
+
+ static partial void Customize(RuntimeEntityType runtimeEntityType);
+ }
+}
diff --git a/src/BlazingPizza.Server/Models/KeyEntityType.cs b/src/BlazingPizza.Server/Models/KeyEntityType.cs
new file mode 100644
index 00000000..f6c6b4c7
--- /dev/null
+++ b/src/BlazingPizza.Server/Models/KeyEntityType.cs
@@ -0,0 +1,96 @@
+//
+using System;
+using System.Reflection;
+using Duende.IdentityServer.EntityFramework.Entities;
+using Microsoft.EntityFrameworkCore.Metadata;
+
+#pragma warning disable 219, 612, 618
+#nullable disable
+
+namespace BlazingPizza.Server.Models
+{
+ internal partial class KeyEntityType
+ {
+ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null)
+ {
+ var runtimeEntityType = model.AddEntityType(
+ "Duende.IdentityServer.EntityFramework.Entities.Key",
+ typeof(Key),
+ baseEntityType);
+
+ var id = runtimeEntityType.AddProperty(
+ "Id",
+ typeof(string),
+ propertyInfo: typeof(Key).GetProperty("Id", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly),
+ fieldInfo: typeof(Key).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly),
+ afterSaveBehavior: PropertySaveBehavior.Throw);
+
+ var algorithm = runtimeEntityType.AddProperty(
+ "Algorithm",
+ typeof(string),
+ propertyInfo: typeof(Key).GetProperty("Algorithm", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly),
+ fieldInfo: typeof(Key).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly),
+ maxLength: 100);
+
+ var created = runtimeEntityType.AddProperty(
+ "Created",
+ typeof(DateTime),
+ propertyInfo: typeof(Key).GetProperty("Created", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly),
+ fieldInfo: typeof(Key).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly));
+
+ var data = runtimeEntityType.AddProperty(
+ "Data",
+ typeof(string),
+ propertyInfo: typeof(Key).GetProperty("Data", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly),
+ fieldInfo: typeof(Key).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly));
+
+ var dataProtected = runtimeEntityType.AddProperty(
+ "DataProtected",
+ typeof(bool),
+ propertyInfo: typeof(Key).GetProperty("DataProtected", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly),
+ fieldInfo: typeof(Key).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly));
+
+ var isX509Certificate = runtimeEntityType.AddProperty(
+ "IsX509Certificate",
+ typeof(bool),
+ propertyInfo: typeof(Key).GetProperty("IsX509Certificate", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly),
+ fieldInfo: typeof(Key).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly));
+
+ var use = runtimeEntityType.AddProperty(
+ "Use",
+ typeof(string),
+ propertyInfo: typeof(Key).GetProperty("Use", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly),
+ fieldInfo: typeof(Key).GetField("