using System.ComponentModel.DataAnnotations.Schema; using System.Data.Entity.ModelConfiguration; namespace IntegrationTests.Models.Mapping { public class RateMap : EntityTypeConfiguration { public RateMap() { // Primary Key this.HasKey(t => t.Id); // Properties // Table & Column Mappings this.ToTable("Rate"); this.Property(t => t.Id).HasColumnName("Id"); this.Property(t => t.ParentId).HasColumnName("ParentId"); this.Property(t => t.ExpenditureCategoryId).HasColumnName("ExpenditureCategoryId"); this.Property(t => t.Rate1).HasColumnName("Rate"); this.Property(t => t.StartDate).HasColumnName("StartDate"); this.Property(t => t.EndDate).HasColumnName("EndDate"); this.Property(t => t.FreezeRate).HasColumnName("FreezeRate"); this.Property(t => t.Type).HasColumnName("Type"); this.Property(t => t.DerivedId).HasColumnName("DerivedId"); // Relationships this.HasRequired(t => t.ExpenditureCategory) .WithMany(t => t.Rates) .HasForeignKey(d => d.ExpenditureCategoryId); } } }