29 lines
937 B
C#
29 lines
937 B
C#
using System.ComponentModel.DataAnnotations.Schema;
|
|
using System.Data.Entity.ModelConfiguration;
|
|
|
|
namespace IntegrationTests.Models.Mapping
|
|
{
|
|
public class ProjectAccessMap : EntityTypeConfiguration<ProjectAccess>
|
|
{
|
|
public ProjectAccessMap()
|
|
{
|
|
// Primary Key
|
|
this.HasKey(t => new { t.PrincipalId, t.ProjectId });
|
|
|
|
// Properties
|
|
// Table & Column Mappings
|
|
this.ToTable("ProjectAccess");
|
|
this.Property(t => t.PrincipalId).HasColumnName("PrincipalId");
|
|
this.Property(t => t.ProjectId).HasColumnName("ProjectId");
|
|
this.Property(t => t.Read).HasColumnName("Read");
|
|
this.Property(t => t.Write).HasColumnName("Write");
|
|
|
|
// Relationships
|
|
this.HasRequired(t => t.Project)
|
|
.WithMany(t => t.ProjectAccesses)
|
|
.HasForeignKey(d => d.ProjectId);
|
|
|
|
}
|
|
}
|
|
}
|