Create db and db access. Add json converter for board array. Add tests for json conversion

This commit is contained in:
jheaps
2025-07-04 13:41:48 -06:00
parent ff1a131a3c
commit 7a532e52e1
18 changed files with 461 additions and 132 deletions
+10
View File
@@ -1,6 +1,8 @@
using JoshHeaps.Net.DAL;
using JoshHeaps.Net.Hubs;
using JoshHeaps.Net.Services.Implementations;
using JoshHeaps.Net.Services.Interfaces;
using Microsoft.EntityFrameworkCore;
namespace JoshHeaps.Net;
@@ -27,9 +29,17 @@ public class Program
builder.Services.AddSingleton<IChessService, ChessService>();
builder.Services.AddSingleton<IBackgroundTaskQueue, BackgroundTaskQueue>();
var cs = builder.Configuration.GetConnectionString("ChessDatabase");
builder.Services.AddDbContext<ChessDbContext>(o => o.UseSqlite(cs));
var app = builder.Build();
using (var scope = app.Services.CreateScope())
{
var dbContext = scope.ServiceProvider.GetRequiredService<ChessDbContext>();
dbContext.Database.Migrate();
}
// Configure the HTTP request pipeline.
if (!app.Environment.IsDevelopment())
{