using AX.FireTrainingSys.Models; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Metadata.Builders; using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; namespace AX.FireTrainingSys.EntityConfigurations { public class TemplateOrganizationConfig : IEntityTypeConfiguration { public void Configure(EntityTypeBuilder entity) { entity.Property(e => e.Id) .IsUnicode(false); entity.HasKey(e => e.Id); entity.HasMany(e => e.Children) .WithOne(e => e.Parent) .HasForeignKey(e => e.ParentId) .OnDelete(DeleteBehavior.Cascade); entity.HasMany(e => e.FireForces) .WithOne(e => e.Organization) .HasForeignKey(e => e.OrganizationId) .OnDelete(DeleteBehavior.Cascade); } } }