EnVisageOnline/Main-RMO/Source/IntegrationTests/Models/Mapping/Company2ViewMap.cs

31 lines
958 B
C#

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