From a304c24b32c0327436bbd8c2853e60668e161b42 Mon Sep 17 00:00:00 2001 From: Ariel Costas Guerrero Date: Mon, 29 Dec 2025 00:41:52 +0100 Subject: Rename a lot of stuff, add Santiago real time --- .../Data/AppDbContext.cs | 59 ---------------------- 1 file changed, 59 deletions(-) delete mode 100644 src/Costasdev.Busurbano.ServiceViewer/Data/AppDbContext.cs (limited to 'src/Costasdev.Busurbano.ServiceViewer/Data/AppDbContext.cs') diff --git a/src/Costasdev.Busurbano.ServiceViewer/Data/AppDbContext.cs b/src/Costasdev.Busurbano.ServiceViewer/Data/AppDbContext.cs deleted file mode 100644 index 50f0791..0000000 --- a/src/Costasdev.Busurbano.ServiceViewer/Data/AppDbContext.cs +++ /dev/null @@ -1,59 +0,0 @@ -using Costasdev.ServiceViewer.Data.Gtfs; -using Costasdev.ServiceViewer.Data.Gtfs.Enums; -using Microsoft.EntityFrameworkCore; - -namespace Costasdev.ServiceViewer.Data; - -public class AppDbContext : DbContext -{ - public AppDbContext(DbContextOptions options) : base(options) - { - } - - protected override void OnModelCreating(ModelBuilder modelBuilder) - { - // Route -> Agency - modelBuilder.Entity() - .HasOne(r => r.Agency) - .WithMany() - .HasForeignKey(r => new { r.AgencyId, r.FeedId }) - .HasPrincipalKey(a => new { a.Id, a.FeedId }); - - // Trip -> Route - modelBuilder.Entity() - .HasOne(t => t.Route) - .WithMany() - .HasForeignKey(t => new { t.RouteId, t.FeedId }) - .HasPrincipalKey(a => new { a.Id, a.FeedId }); - - // Relación StopTimes -> Trip - modelBuilder.Entity() - .HasOne(st => st.GtfsTrip) - .WithMany() - .HasForeignKey(st => new { st.TripId, st.FeedId }) - .HasPrincipalKey(a => new { a.Id, a.FeedId }); - - // Relación StopTimes -> Stop - modelBuilder.Entity() - .HasOne(st => st.GtfsStop) - .WithMany() - .HasForeignKey(st => new { st.StopId, st.FeedId }) - .HasPrincipalKey(a => new { a.Id, a.FeedId }); - - modelBuilder.Entity() - .Property(t => t.TripWheelchairAccessible) - .HasDefaultValue(TripWheelchairAccessible.Empty); - - modelBuilder.Entity() - .Property(t => t.TripBikesAllowed) - .HasDefaultValue(TripBikesAllowed.Empty); - } - - public DbSet Agencies { get; set; } - public DbSet Calendars { get; set; } - public DbSet CalendarDates { get; set; } - public DbSet Routes { get; set; } - public DbSet Stops { get; set; } - public DbSet StopTimes { get; set; } - public DbSet Trips { get; set; } -} -- cgit v1.3