26 lines
666 B
C#
26 lines
666 B
C#
using CodeLiturgy.Data.Capital;
|
|
using Microsoft.EntityFrameworkCore;
|
|
using BlueWest.EfMethods;
|
|
|
|
namespace CodeLiturgy.Domain;
|
|
|
|
public class SiteDbContext: DbContext
|
|
{
|
|
[EfGetOneBy(nameof(Site.Id), typeof(SiteUnique))]
|
|
[EfGetOne(typeof(SiteUnique))]
|
|
[EfAddMethods(createType: typeof(SiteCreate), returnType: typeof(SiteUnique))]
|
|
[EfGetMany(typeof(SiteUnique))]
|
|
|
|
public DbSet<Site> Sites { get; set; }
|
|
|
|
/// <summary>
|
|
/// SiteDbContext Constructor.
|
|
/// </summary>
|
|
/// <param name="options"></param>
|
|
public SiteDbContext(DbContextOptions<SiteDbContext> options) : base(options)
|
|
{
|
|
Database.EnsureCreated();
|
|
}
|
|
|
|
|
|
} |