//---------------------------------------------------------------------------------------------
// 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 ProductReviewConfig : IEntityTypeConfiguration<ProductReview>
    {
        public void Configure(EntityTypeBuilder<ProductReview> c)
        {
            c.ToTable("ProductReview", "Production")
             .HasKey(e => e.ProductReviewId);

            // configure relationships

            c.HasOne(e => e.ProductObject)
             .WithMany()
             .HasForeignKey(e => e.ProductId);

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

            c.Property(e => e.ProductId)
             .HasColumnName("ProductID")
             .HasColumnType("int")
             .IsRequired();

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

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

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

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

            c.Property(e => e.Comments)
             .HasColumnName("Comments")
             .HasColumnType("nvarchar")
             .HasMaxLength(3850)
             .IsUnicode();

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

        }
    }
}