/
UserMap.cs
48 lines (41 loc) · 1.64 KB
/
UserMap.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
using System.Data.Entity.ModelConfiguration;
using AspNetMvcActiveDirectoryOwin.Core.Domain;
namespace AspNetMvcActiveDirectoryOwin.Data.Mapping
{
public class UserMap : EntityTypeConfiguration<User>
{
public UserMap()
{
// Primary Key
this.HasKey(t => t.Id);
// Properties
this.Property(t => t.UserName)
.IsRequired()
.HasMaxLength(50);
this.Property(t => t.FirstName)
.IsRequired()
.HasMaxLength(50);
this.Property(t => t.LastName)
.IsRequired()
.HasMaxLength(50);
this.Property(t => t.CreatedBy)
.IsRequired()
.HasMaxLength(50);
this.Property(t => t.ModifiedBy)
.IsRequired()
.HasMaxLength(50);
// Table & Column Mappings
this.ToTable("User");
this.Property(t => t.Id).HasColumnName("Id");
this.Property(t => t.UserName).HasColumnName("UserName");
this.Property(t => t.FirstName).HasColumnName("FirstName");
this.Property(t => t.LastName).HasColumnName("LastName");
this.Property(t => t.Active).HasColumnName("Active");
this.Property(t => t.LastLoginDate).HasColumnName("LastLoginDate");
this.Property(t => t.CreatedOn).HasColumnName("CreatedOn");
this.Property(t => t.CreatedBy).HasColumnName("CreatedBy");
this.Property(t => t.ModifiedOn).HasColumnName("ModifiedOn");
this.Property(t => t.ModifiedBy).HasColumnName("ModifiedBy");
}
}
}