//---------------------------------------------------------------------------------------------
// 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 AddressConfig : IEntityTypeConfiguration<Address>
    {
        public void Configure(EntityTypeBuilder<Address> c)
        {
            c.ToTable("Address", "Person")
             .HasKey(e => e.AddressId);

            // configure relationships

            c.HasOne(e => e.StateProvinceObject)
             .WithMany()
             .HasForeignKey(e => e.StateProvinceId);

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

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

            c.Property(e => e.AddressLine2)
             .HasColumnName("AddressLine2")
             .HasColumnType("nvarchar")
             .HasMaxLength(60)
             .IsUnicode();

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

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

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

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

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

        }
    }
}