From 0fd8759f3fc8540e76be9e2b0b8e2078880d9b51 Mon Sep 17 00:00:00 2001 From: Slendy Date: Tue, 20 Jun 2023 16:17:12 -0500 Subject: [PATCH] Add design-time factory for DbContext --- ProjectLighthouse/Database/DatabaseContextFactory.cs | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 ProjectLighthouse/Database/DatabaseContextFactory.cs diff --git a/ProjectLighthouse/Database/DatabaseContextFactory.cs b/ProjectLighthouse/Database/DatabaseContextFactory.cs new file mode 100644 index 00000000..8c8dbeee --- /dev/null +++ b/ProjectLighthouse/Database/DatabaseContextFactory.cs @@ -0,0 +1,12 @@ +using Microsoft.EntityFrameworkCore.Design; + +namespace LBPUnion.ProjectLighthouse.Database; + +/// +/// This class is only used for the code-first migration builder to detect the DbContext +/// +// ReSharper disable once UnusedType.Global +public class DatabaseContextFactory : IDesignTimeDbContextFactory +{ + public DatabaseContext CreateDbContext(string[] args) => DatabaseContext.CreateNewInstance(); +} \ No newline at end of file