2023-06-19 15:36:43 -07:00
|
|
|
using Microsoft.EntityFrameworkCore;
|
|
|
|
using Microsoft.EntityFrameworkCore.Design;
|
2023-06-25 21:04:31 -07:00
|
|
|
using Microsoft.Extensions.Configuration;
|
2023-06-19 15:36:43 -07:00
|
|
|
|
|
|
|
namespace Newsbot.Collector.Database;
|
|
|
|
|
|
|
|
public class DesignTimeContext :IDesignTimeDbContextFactory<DatabaseContext>
|
|
|
|
{
|
|
|
|
public DatabaseContext CreateDbContext(string[] args)
|
|
|
|
{
|
|
|
|
var optionsBuilder = new DbContextOptionsBuilder<DatabaseContext>();
|
|
|
|
// pass your design time connection string here
|
|
|
|
optionsBuilder.UseNpgsql("<connection_string>");
|
|
|
|
return new DatabaseContext(optionsBuilder.Options);
|
|
|
|
}
|
|
|
|
}
|