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

            // configure relationships

            c.HasOne(e => e.CountryRegionCodeObject)
             .WithMany()
             .HasForeignKey(e => e.CountryRegionCode);

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

            c.Property(e => e.Name)
             .HasColumnName("Name")
             .HasColumnType("nvarchar")
             .HasMaxLength(50)
             .IsUnicode()
             .IsRequired();

            c.Property(e => e.CountryRegionCode)
             .HasColumnName("CountryRegionCode")
             .HasColumnType("nvarchar")
             .HasMaxLength(3)
             .IsUnicode()
             .IsRequired();

            c.Property(e => e.Group)
             .HasColumnName("Group")
             .HasColumnType("nvarchar")
             .HasMaxLength(50)
             .IsUnicode()
             .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.CostYtd)
             .HasColumnName("CostYTD")
             .HasColumnType("money")
             .IsRequired();

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

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

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

        }
    }
}