From 1bcd8ed2ac5adf6a32b192b95d49fed6e165bac3 Mon Sep 17 00:00:00 2001 From: Lucas Morgan Date: Mon, 26 Jan 2026 19:19:57 -0600 Subject: [PATCH] Add IDesignTimeDbContextFactory for pipeline EF bundle --- .../Identity/ApplicationDbContextFactory.cs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 Shogi/BackEnd/Identity/ApplicationDbContextFactory.cs diff --git a/Shogi/BackEnd/Identity/ApplicationDbContextFactory.cs b/Shogi/BackEnd/Identity/ApplicationDbContextFactory.cs new file mode 100644 index 0000000..47b7de8 --- /dev/null +++ b/Shogi/BackEnd/Identity/ApplicationDbContextFactory.cs @@ -0,0 +1,18 @@ +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Design; + +namespace Shogi.BackEnd.Identity; + +public class ApplicationDbContextFactory : IDesignTimeDbContextFactory +{ + public ApplicationDbContext CreateDbContext(string[] args) + { + var optionsBuilder = new DbContextOptionsBuilder(); + + // This connection string is strictly for design-time tools (like creating migrations). + // It is NOT used when running the app or when applying the migration bundle. + optionsBuilder.UseSqlServer("Server=(localdb)\\mssqllocaldb;Database=ShogiDb;Trusted_Connection=True;MultipleActiveResultSets=true"); + + return new ApplicationDbContext(optionsBuilder.Options); + } +}