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

41 lines
1.2 KiB
C#
Raw Normal View History

2022-11-18 01:39:36 +03:00
using CodeLiturgy.Data.Application;
using Microsoft.EntityFrameworkCore;
using BlueWest.EfMethods;
2022-11-18 03:38:56 +03:00
using CodeLiturgy.Domain.Model;
namespace CodeLiturgy.Domain
{
[EfGenerator]
public class SiteDbContext: DbContext
{
[EfGetOneBy(nameof(Site.Id), typeof(SiteUnique))]
[EfGetOne(typeof(SiteUnique))]
[EfGetMany(typeof(SiteUnique))]
2022-12-02 05:31:11 +03:00
[EfAddMethods(typeof(SiteCreate), typeof(SiteUnique))]
public DbSet<Site> Sites { get; set; }
2022-11-26 01:35:47 +03:00
[EfGetOneBy(nameof(SiteEnvironment.Id), typeof(SiteEnvironmentUnique))]
[EfGetOne(typeof(SiteEnvironmentUnique))]
[EfGetMany(typeof(SiteEnvironmentUnique))]
2022-12-02 05:31:11 +03:00
[EfAddMethods(typeof(SiteEnvironmentCreate), typeof(SiteEnvironmentUnique))]
2022-11-18 03:15:53 +03:00
public DbSet<SiteEnvironment> Environments { get; set; }
/// <summary>
/// SiteDbContext Constructor.
/// </summary>
/// <param name="options"></param>
public SiteDbContext(DbContextOptions<SiteDbContext> options) : base(options)
{
}
2022-11-18 03:38:56 +03:00
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
base.OnModelCreating(modelBuilder);
modelBuilder.ConfigureCurrentDbModel();
}
}
}