using System.ComponentModel.DataAnnotations.Schema; using System.Data.Entity.ModelConfiguration; namespace IntegrationTests.Models.Mapping { public class Team2ViewMap : EntityTypeConfiguration { public Team2ViewMap() { // Primary Key this.HasKey(t => t.Id); // Properties // Table & Column Mappings this.ToTable("Team2View"); this.Property(t => t.Id).HasColumnName("Id"); this.Property(t => t.TeamId).HasColumnName("TeamId"); this.Property(t => t.ViewId).HasColumnName("ViewId"); // Relationships this.HasRequired(t => t.Team) .WithMany(t => t.Team2View) .HasForeignKey(d => d.TeamId); this.HasRequired(t => t.View) .WithMany(t => t.Team2View) .HasForeignKey(d => d.ViewId); } } }