The backend half of the sweep RD-18 did for the front end. git blame holds the provenance and stays correct when the code moves; the comment names a closed ticket and tells the reader nothing the sentence around it does not. public/letter.css and LetterHtml.golden.html change together, because the renderer inlines the CSS and the golden file snapshots the result. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
28 lines
1.1 KiB
C#
28 lines
1.1 KiB
C#
using Microsoft.EntityFrameworkCore;
|
|
using Microsoft.EntityFrameworkCore.Design;
|
|
|
|
namespace BigRegister.Api.Data;
|
|
|
|
/// <summary>
|
|
/// Factory for short-lived <see cref="AppDbContext"/> instances. The three stores
|
|
/// (ApplicationStore/DocumentStore/BriefStore) are static classes — that shape
|
|
/// predates this persistence layer, which keeps that shape — so they can't take a constructor-injected
|
|
/// DbContext; each store method opens one here, uses it, and disposes it under its
|
|
/// own lock instead.
|
|
/// </summary>
|
|
public static class Db
|
|
{
|
|
public static string ConnectionString { get; set; } = "Data Source=bigregister.db";
|
|
|
|
public static AppDbContext Create() =>
|
|
new(new DbContextOptionsBuilder<AppDbContext>().UseSqlite(ConnectionString).Options);
|
|
}
|
|
|
|
/// <summary>Lets `dotnet ef migrations add` construct a context at design time
|
|
/// without booting the full app (no DI registration exists for AppDbContext —
|
|
/// see Db.Create above for why). Auto-discovered by EF Core's tooling.</summary>
|
|
public sealed class AppDbContextFactory : IDesignTimeDbContextFactory<AppDbContext>
|
|
{
|
|
public AppDbContext CreateDbContext(string[] args) => Db.Create();
|
|
}
|