forked from dotnet-architecture/eShopOnWeb
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
net6conversion (dotnet-architecture#642)
* Converting to net6 startup and integration test formats * Update to minimal api and using pagetitle * Adjust functional test fixtures Update ApiEndpoints package version * Finish migration to minimal api startup
- Loading branch information
Showing
34 changed files
with
485 additions
and
714 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,54 +1,49 @@ | ||
using System; | ||
using System.Net.Http; | ||
using System.Threading.Tasks; | ||
using BlazorAdmin; | ||
using BlazorAdmin.Services; | ||
using Blazored.LocalStorage; | ||
using BlazorShared; | ||
using BlazorShared.Models; | ||
using Microsoft.AspNetCore.Components.Authorization; | ||
using Microsoft.AspNetCore.Components.Web; | ||
using Microsoft.AspNetCore.Components.WebAssembly.Hosting; | ||
using Microsoft.Extensions.Configuration; | ||
using Microsoft.Extensions.DependencyInjection; | ||
using Microsoft.Extensions.Logging; | ||
|
||
namespace BlazorAdmin; | ||
var builder = WebAssemblyHostBuilder.CreateDefault(args); | ||
builder.RootComponents.Add<App>("#admin"); | ||
builder.RootComponents.Add<HeadOutlet>("head::after"); | ||
|
||
public class Program | ||
{ | ||
public static async Task Main(string[] args) | ||
{ | ||
var builder = WebAssemblyHostBuilder.CreateDefault(args); | ||
builder.RootComponents.Add<App>("#admin"); | ||
|
||
var configSection = builder.Configuration.GetRequiredSection(BaseUrlConfiguration.CONFIG_NAME); | ||
builder.Services.Configure<BaseUrlConfiguration>(configSection); | ||
var configSection = builder.Configuration.GetRequiredSection(BaseUrlConfiguration.CONFIG_NAME); | ||
builder.Services.Configure<BaseUrlConfiguration>(configSection); | ||
|
||
builder.Services.AddScoped(sp => new HttpClient() { BaseAddress = new Uri(builder.HostEnvironment.BaseAddress) }); | ||
builder.Services.AddScoped(sp => new HttpClient() { BaseAddress = new Uri(builder.HostEnvironment.BaseAddress) }); | ||
|
||
builder.Services.AddScoped<ToastService>(); | ||
builder.Services.AddScoped<HttpService>(); | ||
builder.Services.AddScoped<ToastService>(); | ||
builder.Services.AddScoped<HttpService>(); | ||
|
||
builder.Services.AddBlazoredLocalStorage(); | ||
builder.Services.AddBlazoredLocalStorage(); | ||
|
||
builder.Services.AddAuthorizationCore(); | ||
builder.Services.AddScoped<AuthenticationStateProvider, CustomAuthStateProvider>(); | ||
builder.Services.AddScoped(sp => (CustomAuthStateProvider)sp.GetRequiredService<AuthenticationStateProvider>()); | ||
builder.Services.AddAuthorizationCore(); | ||
builder.Services.AddScoped<AuthenticationStateProvider, CustomAuthStateProvider>(); | ||
builder.Services.AddScoped(sp => (CustomAuthStateProvider)sp.GetRequiredService<AuthenticationStateProvider>()); | ||
|
||
builder.Services.AddBlazorServices(); | ||
builder.Services.AddBlazorServices(); | ||
|
||
builder.Logging.AddConfiguration(builder.Configuration.GetRequiredSection("Logging")); | ||
builder.Logging.AddConfiguration(builder.Configuration.GetRequiredSection("Logging")); | ||
|
||
await ClearLocalStorageCache(builder.Services); | ||
await ClearLocalStorageCache(builder.Services); | ||
|
||
await builder.Build().RunAsync(); | ||
} | ||
await builder.Build().RunAsync(); | ||
|
||
private static async Task ClearLocalStorageCache(IServiceCollection services) | ||
{ | ||
var sp = services.BuildServiceProvider(); | ||
var localStorageService = sp.GetRequiredService<ILocalStorageService>(); | ||
static async Task ClearLocalStorageCache(IServiceCollection services) | ||
{ | ||
var sp = services.BuildServiceProvider(); | ||
var localStorageService = sp.GetRequiredService<ILocalStorageService>(); | ||
|
||
await localStorageService.RemoveItemAsync(typeof(CatalogBrand).Name); | ||
await localStorageService.RemoveItemAsync(typeof(CatalogType).Name); | ||
} | ||
await localStorageService.RemoveItemAsync(typeof(CatalogBrand).Name); | ||
await localStorageService.RemoveItemAsync(typeof(CatalogType).Name); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.