mirror of
https://github.com/aljazceru/btcpayserver.git
synced 2026-01-06 15:44:26 +01:00
Init
This commit is contained in:
24
BTCPayServer/Data/ApplicationDbContextFactory.cs
Normal file
24
BTCPayServer/Data/ApplicationDbContextFactory.cs
Normal file
@@ -0,0 +1,24 @@
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user