2019-01-16 19:38:14 +01:00
|
|
|
|
using Microsoft.EntityFrameworkCore;
|
2019-01-21 18:02:14 +01:00
|
|
|
|
using Microsoft.EntityFrameworkCore.Design;
|
2019-01-16 19:38:14 +01:00
|
|
|
|
using Webhooks.API.Model;
|
|
|
|
|
|
|
|
|
|
namespace Webhooks.API.Infrastructure
|
|
|
|
|
{
|
|
|
|
|
public class WebhooksContext : DbContext
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
public WebhooksContext(DbContextOptions<WebhooksContext> options) : base(options)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
public DbSet<WebhookSubscription> Subscriptions { get; set; }
|
|
|
|
|
}
|
2019-01-21 18:02:14 +01:00
|
|
|
|
|
|
|
|
|
public class WebhooksContextDesignFactory : IDesignTimeDbContextFactory<WebhooksContext>
|
|
|
|
|
{
|
|
|
|
|
public WebhooksContext CreateDbContext(string[] args)
|
|
|
|
|
{
|
|
|
|
|
var optionsBuilder = new DbContextOptionsBuilder<WebhooksContext>()
|
|
|
|
|
.UseSqlServer("Server=.;Initial Catalog=Microsoft.eShopOnContainers.Services.CatalogDb;Integrated Security=true");
|
|
|
|
|
|
|
|
|
|
return new WebhooksContext(optionsBuilder.Options);
|
|
|
|
|
}
|
|
|
|
|
}
|
2019-01-16 19:38:14 +01:00
|
|
|
|
}
|