mirror of
https://github.com/btcpayserver/btcpayserver.git
synced 2025-02-23 14:40:36 +01:00
24 lines
582 B
C#
24 lines
582 B
C#
using Microsoft.EntityFrameworkCore;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace BTCPayServer.Data
|
|
{
|
|
public class ApplicationDbContextFactory
|
|
{
|
|
string _Path;
|
|
public ApplicationDbContextFactory(string path)
|
|
{
|
|
_Path = path ?? throw new ArgumentNullException(nameof(path));
|
|
}
|
|
|
|
public ApplicationDbContext CreateContext()
|
|
{
|
|
var builder = new DbContextOptionsBuilder<ApplicationDbContext>();
|
|
builder.UseSqlite("Data Source=" + _Path);
|
|
return new ApplicationDbContext(builder.Options);
|
|
}
|
|
}
|
|
}
|