//---------------------------------------------------------------------------------------------
// 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 PurchaseOrderHeaderConfig : IEntityTypeConfiguration<PurchaseOrderHeader>
    {
        public void Configure(EntityTypeBuilder<PurchaseOrderHeader> c)
        {
            c.ToTable("PurchaseOrderHeader", "Purchasing")
             .HasKey(e => e.PurchaseOrderId);

            // configure relationships

            c.HasOne(e => e.EmployeeObject)
             .WithMany()
             .HasForeignKey(e => e.EmployeeId);

            c.HasOne(e => e.VendorObject)
             .WithMany()
             .HasForeignKey(e => e.VendorId);

            c.HasOne(e => e.ShipMethodObject)
             .WithMany()
             .HasForeignKey(e => e.ShipMethodId);

            // configure properties
          
            c.Property(e => e.PurchaseOrderId)
             .HasColumnName("PurchaseOrderID")
             .HasColumnType("int")
             .IsRequired()
             .ValueGeneratedOnAdd();

            c.Property(e => e.RevisionNumber)
             .HasColumnName("RevisionNumber")
             .HasColumnType("tinyint")
             .IsRequired();

            c.Property(e => e.Status)
             .HasColumnName("Status")
             .HasColumnType("tinyint")
             .IsRequired();

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

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

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

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

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

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

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

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

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

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

        }
    }
}