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

            // configure relationships

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

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

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

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

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

            c.Property(e => e.PreferredVendorStatus)
             .HasColumnName("PreferredVendorStatus")
             .HasColumnType("bit")
             .IsRequired();

            c.Property(e => e.ActiveFlag)
             .HasColumnName("ActiveFlag")
             .HasColumnType("bit")
             .IsRequired();

            c.Property(e => e.PurchasingWebServiceUrl)
             .HasColumnName("PurchasingWebServiceURL")
             .HasColumnType("nvarchar")
             .HasMaxLength(1024)
             .IsUnicode();

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

        }
    }
}