-
Notifications
You must be signed in to change notification settings - Fork 1
/
Program.cs
25 lines (20 loc) · 942 Bytes
/
Program.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
using FuelEconomy;
using FuelEconomy.Services;
using Microsoft.AspNetCore.Components.Web;
using Microsoft.AspNetCore.Components.WebAssembly.Hosting;
using Radzen;
var builder = WebAssemblyHostBuilder.CreateDefault(args);
builder.RootComponents.Add<App>("#app");
builder.RootComponents.Add<HeadOutlet>("head::after");
builder.Services.AddScoped(_ => new HttpClient { BaseAddress = new Uri(builder.HostEnvironment.BaseAddress) });
builder.Services.AddSingleton<LocalStorageService>();
builder.Services.AddSingleton<AppStateService>();
builder.Services.AddSingleton<VehicleService>();
builder.Services.AddSingleton<EntriesService>();
builder.Services.AddSingleton<VehicleStatisticsService>();
builder.Services.AddRadzenComponents();
var built = builder.Build();
// Initialize any db stuff
var appStateService = built.Services.GetRequiredService<AppStateService>();
await appStateService.InitializeIfNecessaryAsync();
await built.RunAsync();