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

41 lines
1.2 KiB
C#

using CodeLiturgy.Data.Application;
using Microsoft.EntityFrameworkCore;
using BlueWest.EfMethods;
using CodeLiturgy.Domain.Model;
namespace CodeLiturgy.Domain
{
[EfGenerator]
public class SiteDbContext: DbContext
{
[EfGetOneBy(nameof(Site.Id), typeof(SiteUnique))]
[EfGetOne(typeof(SiteUnique))]
[EfGetMany(typeof(SiteUnique))]
[EfAddMethods(typeof(SiteCreate), typeof(SiteUnique))]
public DbSet<Site> Sites { get; set; }
[EfGetOneBy(nameof(SiteEnvironment.Id), typeof(SiteEnvironmentUnique))]
[EfGetOne(typeof(SiteEnvironmentUnique))]
[EfGetMany(typeof(SiteEnvironmentUnique))]
[EfAddMethods(typeof(SiteEnvironmentCreate), typeof(SiteEnvironmentUnique))]
public DbSet<SiteEnvironment> Environments { get; set; }
/// <summary>
/// SiteDbContext Constructor.
/// </summary>
/// <param name="options"></param>
public SiteDbContext(DbContextOptions<SiteDbContext> options) : base(options)
{
}
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
base.OnModelCreating(modelBuilder);
modelBuilder.ConfigureCurrentDbModel();
}
}
}