Closed Giant150 closed 4 years ago
特定的表要重写OnModelCreating 所以增加了IEntityTypeConfiguration配置支持 这样可以在Entity里增加OnModelCreating的配置 ` public class pbpd_modelmaterialEntityTypeConfig : IEntityTypeConfiguration { public void Configure(EntityTypeBuilder builder) { builder .HasKey(t => new { t.MaterialId, t.ModelId });
builder.HasOne(pt => pt.Material) .WithMany(p => p.ModelMaterials) .HasForeignKey(pt => pt.MaterialId); builder.HasOne(pt => pt.Model) .WithMany(p => p.ModelMaterials) .HasForeignKey(pt => pt.ModelId); } }
`
特定的表要重写OnModelCreating 所以增加了IEntityTypeConfiguration配置支持 这样可以在Entity里增加OnModelCreating的配置 ` public class pbpd_modelmaterialEntityTypeConfig : IEntityTypeConfiguration
{
public void Configure(EntityTypeBuilder builder)
{
builder
.HasKey(t => new { t.MaterialId, t.ModelId });
`