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<CraftMaterial>
    {
        public void Configure(EntityTypeBuilder<CraftMaterial> builder)
        {
            builder.ToTable("CraftMaterials");

            builder.HasKey(ce => new { ce.CraftId, ce.MaterialId });

            builder.HasOne(rp => rp.Craft)
                .WithMany(r => r.CraftMaterials);
        }
    }
}
