Add entity framework (#11)

Co-authored-by: Maxime Adler <madler@sqli.com>
Reviewed-on: #11
This commit was merged in pull request #11.
This commit is contained in:
2025-04-09 23:12:48 +02:00
parent 3d5056ce91
commit 3537465588
22 changed files with 1617 additions and 38 deletions

View File

@@ -29,15 +29,20 @@ builder.Services.AddSingleton<Translations>();
var app = builder.Build();
var client = app.Services.GetService<IHttpClientFactory>()?.CreateClient("GameIdeas.WebAPI") ??
throw new Exception("Http client not found");
var response = await client.GetAsync("api/Translations");
var dictionary = await response.Content.ReadFromJsonAsync<Dictionary<string, string>>();
await FetchTranslation(app);
if (dictionary != null)
await app.RunAsync();
static async Task FetchTranslation(WebAssemblyHost app)
{
app.Services.GetService<TranslationService>()!.Initialize(dictionary);
ResourcesKey.Initialize(app.Services.GetService<Translations>()!);
}
var client = app.Services.GetService<IHttpClientFactory>()?.CreateClient("GameIdeas.WebAPI") ??
throw new Exception("Http client not found");
var response = await client.GetAsync("api/Translations");
var dictionary = await response.Content.ReadFromJsonAsync<Dictionary<string, string>>();
await app.RunAsync();
if (dictionary != null)
{
app.Services.GetService<TranslationService>()!.Initialize(dictionary);
ResourcesKey.Initialize(app.Services.GetService<Translations>()!);
}
}