using AutobusApi.Domain.Entities; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Metadata.Builders; namespace AutobusApi.Infrastructure.Data.Configurations; public class RouteConfiguration : EntityBaseConfiguration { public override void Configure(EntityTypeBuilder builder) { base.Configure(builder); builder .ToTable("routes") .HasKey(e => e.Id); builder .HasMany(r => r.VehicleEnrollments) .WithOne(ve => ve.Route) .OnDelete(DeleteBehavior.Cascade); builder .HasMany(r => r.RouteAddresses) .WithOne(ra => ra.Route) .OnDelete(DeleteBehavior.Cascade); } }