Update README.md with project details, features, requirements, architecture, and data management for PLib video library manager.

This commit is contained in:
Leonid Pershin
2026-08-08 07:08:43 +03:00
parent e767e4a48c
commit ac05ea6b7f
59 changed files with 3010 additions and 0 deletions
@@ -0,0 +1,29 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
namespace PLib.Infrastructure.Persistence;
/// <summary>
/// Brings the local database up to date before the first window is shown.
/// </summary>
/// <remarks>
/// While the schema is still moving we create it from the model. Once the shape settles this
/// becomes <c>MigrateAsync</c> plus a checked-in migration history.
/// </remarks>
public sealed class DatabaseInitializer(
IServiceScopeFactory scopeFactory,
ILogger<DatabaseInitializer> logger) : IHostedService
{
public async Task StartAsync(CancellationToken cancellationToken)
{
await using var scope = scopeFactory.CreateAsyncScope();
var dbContext = scope.ServiceProvider.GetRequiredService<LibraryDbContext>();
var created = await dbContext.Database.EnsureCreatedAsync(cancellationToken);
logger.LogInformation("Library database ready (created: {Created})", created);
}
public Task StopAsync(CancellationToken cancellationToken) => Task.CompletedTask;
}