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

54 lines
1.8 KiB
C#

using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;
namespace IntegrationTests.Models.Mapping
{
public class AspNetUserMap : EntityTypeConfiguration<AspNetUser>
{
public AspNetUserMap()
{
// Primary Key
this.HasKey(t => t.Id);
// Properties
this.Property(t => t.Id)
.IsRequired()
.HasMaxLength(128);
this.Property(t => t.UserName)
.HasMaxLength(4000);
this.Property(t => t.PasswordHash)
.HasMaxLength(4000);
this.Property(t => t.SecurityStamp)
.HasMaxLength(4000);
this.Property(t => t.Discriminator)
.HasMaxLength(256);
this.Property(t => t.Email)
.HasMaxLength(256);
this.Property(t => t.Phone)
.HasMaxLength(20);
this.Property(t => t.PagePreferences)
.IsRequired();
// Table & Column Mappings
this.ToTable("AspNetUsers");
this.Property(t => t.Id).HasColumnName("Id");
this.Property(t => t.UserName).HasColumnName("UserName");
this.Property(t => t.PasswordHash).HasColumnName("PasswordHash");
this.Property(t => t.SecurityStamp).HasColumnName("SecurityStamp");
this.Property(t => t.Discriminator).HasColumnName("Discriminator");
this.Property(t => t.Email).HasColumnName("Email");
this.Property(t => t.Phone).HasColumnName("Phone");
this.Property(t => t.Type).HasColumnName("Type");
this.Property(t => t.PreferredResourceAllocation).HasColumnName("PreferredResourceAllocation");
this.Property(t => t.PagePreferences).HasColumnName("PagePreferences");
}
}
}