//---------------------------------------------------------------------------------------------
// 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 ProductProductPhotoConfig : IEntityTypeConfiguration<ProductProductPhoto>
    {
        public void Configure(EntityTypeBuilder<ProductProductPhoto> c)
        {
            c.ToTable("ProductProductPhoto", "Production")
             .HasKey(e => new { e.ProductId, e.ProductPhotoId });

            // configure relationships

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

            c.HasOne(e => e.ProductPhotoObject)
             .WithMany()
             .HasForeignKey(e => e.ProductPhotoId);

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

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

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

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

        }
    }
}