CraftMaterialMapping.cs 723 B

1234567891011121314151617181920212223
  1. using Microsoft.EntityFrameworkCore;
  2. using Microsoft.EntityFrameworkCore.Metadata.Builders;
  3. using GreenTree.Strohrmann.ERP.Core.Domain.Rights;
  4. using System;
  5. using System.Collections.Generic;
  6. using System.Text;
  7. using GreenTree.Strohrmann.ERP.Core.Domain.Business;
  8. namespace GreenTree.Strohrmann.ERP.Domain.Model.Business
  9. {
  10. public class CraftMaterialMapping : IEntityTypeConfiguration<CraftMaterial>
  11. {
  12. public void Configure(EntityTypeBuilder<CraftMaterial> builder)
  13. {
  14. builder.ToTable("CraftMaterials");
  15. builder.HasKey(ce => new { ce.CraftId, ce.MaterialId });
  16. builder.HasOne(rp => rp.Craft)
  17. .WithMany(r => r.CraftMaterials);
  18. }
  19. }
  20. }