31 lines
958 B
C#
31 lines
958 B
C#
using System.ComponentModel.DataAnnotations.Schema;
|
|
using System.Data.Entity.ModelConfiguration;
|
|
|
|
namespace IntegrationTests.Models.Mapping
|
|
{
|
|
public class Team2ProjectMap : EntityTypeConfiguration<Team2Project>
|
|
{
|
|
public Team2ProjectMap()
|
|
{
|
|
// Primary Key
|
|
this.HasKey(t => t.Id);
|
|
|
|
// Properties
|
|
// Table & Column Mappings
|
|
this.ToTable("Team2Project");
|
|
this.Property(t => t.Id).HasColumnName("Id");
|
|
this.Property(t => t.TeamId).HasColumnName("TeamId");
|
|
this.Property(t => t.ProjectId).HasColumnName("ProjectId");
|
|
|
|
// Relationships
|
|
this.HasRequired(t => t.Project)
|
|
.WithMany(t => t.Team2Project)
|
|
.HasForeignKey(d => d.ProjectId);
|
|
this.HasRequired(t => t.Team)
|
|
.WithMany(t => t.Team2Project)
|
|
.HasForeignKey(d => d.TeamId);
|
|
|
|
}
|
|
}
|
|
}
|