29 lines
771 B
C#
29 lines
771 B
C#
using Microsoft.EntityFrameworkCore;
|
|
using Microsoft.EntityFrameworkCore.Design;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace DaSaSo.EntityFramework
|
|
{
|
|
public class DaSaSoDbContextFactory
|
|
{
|
|
private readonly string _connectionString;
|
|
|
|
public DaSaSoDbContextFactory(string connectionString)
|
|
{
|
|
_connectionString = connectionString;
|
|
}
|
|
|
|
public DaSaSoDbContext CreateDbContext()
|
|
{
|
|
var options = new DbContextOptionsBuilder<DaSaSoDbContext>();
|
|
options.UseNpgsql(_connectionString);
|
|
DaSaSoDbContext result = new DaSaSoDbContext(options.Options);
|
|
return result;
|
|
}
|
|
}
|
|
}
|