2023-02-16 18:51:54 +00:00
|
|
|
|
using Microsoft.EntityFrameworkCore;
|
|
|
|
|
|
|
|
|
|
namespace Pal.Client.Database
|
|
|
|
|
{
|
|
|
|
|
internal class PalClientContext : DbContext
|
|
|
|
|
{
|
2023-02-17 17:36:22 +00:00
|
|
|
|
public DbSet<ClientLocation> Locations { get; set; } = null!;
|
2023-02-16 18:51:54 +00:00
|
|
|
|
public DbSet<ImportHistory> Imports { get; set; } = null!;
|
2023-02-17 17:36:22 +00:00
|
|
|
|
public DbSet<RemoteEncounter> RemoteEncounters { get; set; } = null!;
|
2023-02-16 18:51:54 +00:00
|
|
|
|
|
|
|
|
|
public PalClientContext(DbContextOptions<PalClientContext> options)
|
|
|
|
|
: base(options)
|
|
|
|
|
{
|
|
|
|
|
}
|
2023-02-17 17:36:22 +00:00
|
|
|
|
|
|
|
|
|
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
|
|
|
|
{
|
|
|
|
|
modelBuilder.Entity<ClientLocation>()
|
|
|
|
|
.HasMany(o => o.ImportedBy)
|
|
|
|
|
.WithMany(o => o.ImportedLocations)
|
|
|
|
|
.UsingEntity(o => o.ToTable("LocationImports"));
|
|
|
|
|
}
|
2023-02-16 18:51:54 +00:00
|
|
|
|
}
|
|
|
|
|
}
|