Files
Walleby/Bitvault/VaultDbContext.cs
T
TheXamlGuy 7cbca0783f WIP
2024-05-04 15:13:46 +01:00

27 lines
638 B
C#

using Microsoft.EntityFrameworkCore;
namespace Bitvault;
public class VaultDbContext(DbContextOptions<VaultDbContext> options) :
DbContext(options)
{
public DbSet<Category> Categories { get; set; }
public DbSet<Document> Documents { get; set; }
public DbSet<Locker> Lockers { get; set; }
public DbSet<Tag> Tags { get; set; }
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
modelBuilder.Entity<Locker>()
.HasMany(x => x.Tags)
.WithOne();
modelBuilder.Entity<Locker>()
.HasMany(x => x.Documents)
.WithOne();
}
}