summaryrefslogtreecommitdiff
path: root/backend/Elements.Data/ApplicationContextFactory.cs
blob: b8e4ebd30b95ec09df861f2d1e84517be11dcbeb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Design;

namespace Elements.Data;

public class ApplicationContextFactory : IDesignTimeDbContextFactory<ApplicationDbContext>
{
    public ApplicationDbContext CreateDbContext(string[] args)
    {
        DbContextOptionsBuilder<ApplicationDbContext> optionsBuilder = new();
        optionsBuilder.UseSqlite("Data Source=elements.db");

        return new ApplicationDbContext(optionsBuilder.Options);
    }
}