EnVisageOnline/Beta/Source/IntegrationTests/Models/Mapping/View2CostCenterMap.cs

31 lines
994 B
C#

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