CodeLiturgy.Dashboard/CodeLiturgy.Views/DbContexts/SiteDbContext.cs

29 lines
737 B
C#

using CodeLiturgy.Data.Application;
using Microsoft.EntityFrameworkCore;
using BlueWest.EfMethods;
namespace CodeLiturgy.Domain
{
[EfGenerator]
public class SiteDbContext: DbContext
{
[EfGetOneBy(nameof(Site.Id), typeof(SiteUnique))]
[EfGetOne(typeof(SiteUnique))]
[EfGetMany(typeof(SiteUnique))]
public DbSet<Site> Sites { get; set; }
public DbSet<SiteEnvironment> Environments { get; set; }
/// <summary>
/// SiteDbContext Constructor.
/// </summary>
/// <param name="options"></param>
public SiteDbContext(DbContextOptions<SiteDbContext> options) : base(options)
{
Database.EnsureCreated();
}
}
}