mirror of
https://github.com/aljazceru/btcpayserver.git
synced 2026-01-08 08:34:25 +01:00
This allows plugins to create custom dbcontexts, which would be namespaced in the scheme with a prefix. Migrations are supported too and the table would be prefixed too
22 lines
658 B
C#
22 lines
658 B
C#
using BTCPayServer.Abstractions.Contracts;
|
|
using BTCPayServer.Abstractions.Models;
|
|
using Microsoft.EntityFrameworkCore;
|
|
|
|
namespace BTCPayServer.Data
|
|
{
|
|
public class ApplicationDbContextFactory : BaseDbContextFactory<ApplicationDbContext>
|
|
{
|
|
public ApplicationDbContextFactory(DatabaseOptions options) : base(options,
|
|
"BTCPayServer.Data", "")
|
|
{
|
|
}
|
|
|
|
public override ApplicationDbContext CreateContext()
|
|
{
|
|
var builder = new DbContextOptionsBuilder<ApplicationDbContext>();
|
|
ConfigureBuilder(builder);
|
|
return new ApplicationDbContext(builder.Options);
|
|
}
|
|
}
|
|
}
|