31 lines
928 B
C#
31 lines
928 B
C#
using System.ComponentModel.DataAnnotations.Schema;
|
|
using System.Data.Entity.ModelConfiguration;
|
|
|
|
namespace IntegrationTests.Models.Mapping
|
|
{
|
|
public class Team2ViewMap : EntityTypeConfiguration<Team2View>
|
|
{
|
|
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);
|
|
|
|
}
|
|
}
|
|
}
|