using System.ComponentModel.DataAnnotations.Schema; using System.Data.Entity.ModelConfiguration; namespace IntegrationTests.Models.Mapping { public class PeopleResourceAllocationMap : EntityTypeConfiguration { public PeopleResourceAllocationMap() { // Primary Key this.HasKey(t => t.Id); // Properties // Table & Column Mappings this.ToTable("PeopleResourceAllocation"); this.Property(t => t.Id).HasColumnName("Id"); this.Property(t => t.ScenarioId).HasColumnName("ScenarioId"); this.Property(t => t.PeopleResourceId).HasColumnName("PeopleResourceId"); this.Property(t => t.ExpenditureCategoryId).HasColumnName("ExpenditureCategoryId"); this.Property(t => t.WeekEndingDate).HasColumnName("WeekEndingDate"); this.Property(t => t.Quantity).HasColumnName("Quantity"); this.Property(t => t.LastUpdate).HasColumnName("LastUpdate"); // Relationships this.HasRequired(t => t.ExpenditureCategory) .WithMany(t => t.PeopleResourceAllocations) .HasForeignKey(d => d.ExpenditureCategoryId); this.HasRequired(t => t.PeopleResource) .WithMany(t => t.PeopleResourceAllocations) .HasForeignKey(d => d.PeopleResourceId); this.HasRequired(t => t.Scenario) .WithMany(t => t.PeopleResourceAllocations) .HasForeignKey(d => d.ScenarioId); } } }