37 lines
1.2 KiB
C#
37 lines
1.2 KiB
C#
using System.ComponentModel.DataAnnotations.Schema;
|
|
using System.Data.Entity.ModelConfiguration;
|
|
|
|
namespace IntegrationTests.Models.Mapping
|
|
{
|
|
public class HistoryMap : EntityTypeConfiguration<History>
|
|
{
|
|
public HistoryMap()
|
|
{
|
|
// Primary Key
|
|
this.HasKey(t => t.Id);
|
|
|
|
// Properties
|
|
this.Property(t => t.XML)
|
|
.IsRequired();
|
|
|
|
this.Property(t => t.EntityType)
|
|
.IsRequired()
|
|
.HasMaxLength(50);
|
|
|
|
this.Property(t => t.ModificationType)
|
|
.IsRequired()
|
|
.HasMaxLength(10);
|
|
|
|
// Table & Column Mappings
|
|
this.ToTable("History");
|
|
this.Property(t => t.Id).HasColumnName("Id");
|
|
this.Property(t => t.EntityId).HasColumnName("EntityId");
|
|
this.Property(t => t.XML).HasColumnName("XML");
|
|
this.Property(t => t.TimeStamp).HasColumnName("TimeStamp");
|
|
this.Property(t => t.ModifiedBy).HasColumnName("ModifiedBy");
|
|
this.Property(t => t.EntityType).HasColumnName("EntityType");
|
|
this.Property(t => t.ModificationType).HasColumnName("ModificationType");
|
|
}
|
|
}
|
|
}
|