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

            // configure relationships

            c.HasOne(e => e.FromCurrencyCodeObject)
             .WithMany()
             .HasForeignKey(e => e.FromCurrencyCode);

            c.HasOne(e => e.ToCurrencyCodeObject)
             .WithMany()
             .HasForeignKey(e => e.ToCurrencyCode);

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

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

            c.Property(e => e.FromCurrencyCode)
             .HasColumnName("FromCurrencyCode")
             .HasColumnType("nchar")
             .HasMaxLength(3)
             .IsUnicode()
             .IsFixedLength()
             .IsRequired();

            c.Property(e => e.ToCurrencyCode)
             .HasColumnName("ToCurrencyCode")
             .HasColumnType("nchar")
             .HasMaxLength(3)
             .IsUnicode()
             .IsFixedLength()
             .IsRequired();

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

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

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

        }
    }
}