2023-02-16 18:51:54 +00:00
|
|
|
|
using Microsoft.EntityFrameworkCore;
|
|
|
|
|
|
2023-03-30 20:01:43 +00:00
|
|
|
|
namespace Pal.Client.Database;
|
|
|
|
|
|
|
|
|
|
internal class PalClientContext : DbContext
|
2023-02-16 18:51:54 +00:00
|
|
|
|
{
|
2023-03-30 20:01:43 +00:00
|
|
|
|
public DbSet<ClientLocation> Locations { get; set; } = null!;
|
|
|
|
|
public DbSet<ImportHistory> Imports { get; set; } = null!;
|
|
|
|
|
public DbSet<RemoteEncounter> RemoteEncounters { get; set; } = null!;
|
2023-02-16 18:51:54 +00:00
|
|
|
|
|
2023-03-30 20:01:43 +00:00
|
|
|
|
public PalClientContext(DbContextOptions<PalClientContext> options)
|
|
|
|
|
: base(options)
|
|
|
|
|
{
|
|
|
|
|
}
|
2023-02-17 17:36:22 +00:00
|
|
|
|
|
2023-03-30 20:01:43 +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
|
|
|
|
}
|
|
|
|
|
}
|