using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Metadata.Builders; using GreenTree.Strohrmann.ERP.Core.Domain.Rights; using System; using System.Collections.Generic; using System.Text; using GreenTree.Strohrmann.ERP.Core.Domain.Business; namespace GreenTree.Strohrmann.ERP.Domain.Model.Business { public class CraftMaterialMapping : IEntityTypeConfiguration { public void Configure(EntityTypeBuilder builder) { builder.ToTable("CraftMaterials"); builder.HasKey(cm => new { cm.CraftId, cm.MaterialId }); builder.Property(cm => cm.Amount) .IsRequired(); builder.Property(cm => cm.CalculationFactor) .IsRequired(); builder.Property(cm => cm.Value) .IsRequired(); builder.HasOne(rp => rp.Craft) .WithMany(r => r.CraftMaterials); } } }