//---------------------------------------------------------------------------------------------
// 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 SalesPersonConfig : IEntityTypeConfiguration<SalesPerson>
    {
        public void Configure(EntityTypeBuilder<SalesPerson> c)
        {
            c.ToTable("SalesPerson", "Sales")
             .HasKey(e => e.BusinessEntityId);

            // configure relationships

            c.HasOne(e => e.BusinessEntityObject)
             .WithOne()
             .HasForeignKey<SalesPerson>(e => e.BusinessEntityId);

            c.HasOne(e => e.TerritoryObject)
             .WithMany()
             .HasForeignKey(e => e.TerritoryId);

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

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

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

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

            c.Property(e => e.CommissionPct)
             .HasColumnName("CommissionPct")
             .HasColumnType("smallmoney")
             .IsRequired();

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

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

            c.Property(e => e.Rowguid)
             .HasColumnName("rowguid")
             .HasColumnType("uniqueidentifier")
             .IsRequired();

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

        }
    }
}