OpenAuth.Net/OpenAuth.Repository/Models/Mapping/RoleMap.cs

45 lines
1.5 KiB
C#
Raw Normal View History

2015-10-26 21:58:12 +08:00
using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;
using OpenAuth.Domain;
namespace OpenAuth.Repository.Models.Mapping
{
public class RoleMap : EntityTypeConfiguration<Role>
{
public RoleMap()
{
// Primary Key
this.HasKey(t => t.Id);
// Properties
this.Property(t => t.Name)
.IsRequired()
.HasMaxLength(255);
this.Property(t => t.CreateId)
.IsRequired()
.HasMaxLength(64);
2015-11-19 21:49:39 +08:00
this.Property(t => t.OrgCascadeId)
.IsRequired()
.HasMaxLength(255);
this.Property(t => t.OrgName)
2015-10-26 21:58:12 +08:00
.IsRequired()
.HasMaxLength(255);
// Table & Column Mappings
this.ToTable("Role");
this.Property(t => t.Id).HasColumnName("Id");
this.Property(t => t.Name).HasColumnName("Name");
this.Property(t => t.Status).HasColumnName("Status");
this.Property(t => t.Type).HasColumnName("Type");
this.Property(t => t.CreateTime).HasColumnName("CreateTime");
this.Property(t => t.CreateId).HasColumnName("CreateId");
2015-11-19 21:49:39 +08:00
this.Property(t => t.OrgId).HasColumnName("OrgId");
this.Property(t => t.OrgCascadeId).HasColumnName("OrgCascadeId");
this.Property(t => t.OrgName).HasColumnName("OrgName");
2015-10-26 21:58:12 +08:00
}
}
}