消防培训系统服务器
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

31 lines
978 B

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<TemplateOrganization>
{
public void Configure(EntityTypeBuilder<TemplateOrganization> 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);
}
}
}