blob: f4849d7ad63e74e3e34f589bdaabc563ddf8f911 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Design;
using Microsoft.Extensions.Configuration;
using System.IO;
namespace DevHive.Data
{
public class DevHiveContextFactory : IDesignTimeDbContextFactory<DevHiveContext>
{
public DevHiveContext CreateDbContext(string[] args)
{
var configuration = new ConfigurationBuilder()
.SetBasePath(Directory.GetCurrentDirectory())
.AddJsonFile("ConnectionString.json")
.Build();
var optionsBuilder = new DbContextOptionsBuilder<DevHiveContext>()
.UseNpgsql(configuration.GetConnectionString("DEV"));
return new DevHiveContext(optionsBuilder.Options);
}
}
}
|