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

30 lines
887 B
C#

using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;
namespace IntegrationTests.Models.Mapping
{
public class CreditDepartmentMap : EntityTypeConfiguration<CreditDepartment>
{
public CreditDepartmentMap()
{
// Primary Key
this.HasKey(t => t.Id);
// Properties
this.Property(t => t.Name)
.IsRequired()
.HasMaxLength(200);
this.Property(t => t.CreditNumber)
.IsRequired()
.HasMaxLength(100);
// Table & Column Mappings
this.ToTable("CreditDepartment");
this.Property(t => t.Id).HasColumnName("Id");
this.Property(t => t.Name).HasColumnName("Name");
this.Property(t => t.CreditNumber).HasColumnName("CreditNumber");
}
}
}