//---------------------------------------------------------------------------------------------
// This file was AUTO-GENERATED by "EF Domain Objects" Xomega.Net generator.
//
// Manual CHANGES to this file WILL BE LOST when the code is regenerated.
//---------------------------------------------------------------------------------------------

using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;

namespace AdventureWorks.Services.Entities
{
    public class ProductVendorConfig : IEntityTypeConfiguration<ProductVendor>
    {
        public void Configure(EntityTypeBuilder<ProductVendor> c)
        {
            c.ToTable("ProductVendor", "Purchasing")
             .HasKey(e => new { e.ProductId, e.BusinessEntityId });

            // configure relationships

            c.HasOne(e => e.ProductObject)
             .WithMany()
             .HasForeignKey(e => e.ProductId);

            c.HasOne(e => e.BusinessEntityObject)
             .WithMany()
             .HasForeignKey(e => e.BusinessEntityId);

            c.HasOne(e => e.UnitMeasureCodeObject)
             .WithMany()
             .HasForeignKey(e => e.UnitMeasureCode);

            // configure properties
          
            c.Property(e => e.ProductId)
             .HasColumnName("ProductID")
             .HasColumnType("int")
             .IsRequired();

            c.Property(e => e.BusinessEntityId)
             .HasColumnName("BusinessEntityID")
             .HasColumnType("int")
             .IsRequired();

            c.Property(e => e.AverageLeadTime)
             .HasColumnName("AverageLeadTime")
             .HasColumnType("int")
             .IsRequired();

            c.Property(e => e.StandardPrice)
             .HasColumnName("StandardPrice")
             .HasColumnType("money")
             .IsRequired();

            c.Property(e => e.LastReceiptCost)
             .HasColumnName("LastReceiptCost")
             .HasColumnType("money");

            c.Property(e => e.LastReceiptDate)
             .HasColumnName("LastReceiptDate")
             .HasColumnType("datetime");

            c.Property(e => e.MinOrderQty)
             .HasColumnName("MinOrderQty")
             .HasColumnType("int")
             .IsRequired();

            c.Property(e => e.MaxOrderQty)
             .HasColumnName("MaxOrderQty")
             .HasColumnType("int")
             .IsRequired();

            c.Property(e => e.OnOrderQty)
             .HasColumnName("OnOrderQty")
             .HasColumnType("int");

            c.Property(e => e.UnitMeasureCode)
             .HasColumnName("UnitMeasureCode")
             .HasColumnType("nchar")
             .HasMaxLength(3)
             .IsUnicode()
             .IsFixedLength()
             .IsRequired();

            c.Property(e => e.ModifiedDate)
             .HasColumnName("ModifiedDate")
             .HasColumnType("datetime")
             .IsRequired();

        }
    }
}