mirror of
https://gitee.com/dotnetchina/OpenAuth.Net.git
synced 2025-07-18 22:35:58 +08:00
34 lines
950 B
C#
34 lines
950 B
C#
![]() |
using System.Data.Entity.ModelConfiguration;
|
||
|
using OpenAuth.Domain;
|
||
|
|
||
|
namespace OpenAuth.Repository.Models.Mapping
|
||
|
{
|
||
|
public class UserRoleMap : EntityTypeConfiguration<UserRole>
|
||
|
{
|
||
|
public UserRoleMap()
|
||
|
{
|
||
|
// Primary Key
|
||
|
this.HasKey(t => t.UserRoleId);
|
||
|
|
||
|
// Properties
|
||
|
this.Property(t => t.UserRoleId)
|
||
|
.IsRequired()
|
||
|
.HasMaxLength(50);
|
||
|
|
||
|
this.Property(t => t.UserId)
|
||
|
.IsRequired()
|
||
|
.HasMaxLength(50);
|
||
|
|
||
|
this.Property(t => t.RoleId)
|
||
|
.IsRequired()
|
||
|
.HasMaxLength(50);
|
||
|
|
||
|
// Table & Column Mappings
|
||
|
this.ToTable("UserRole");
|
||
|
this.Property(t => t.UserRoleId).HasColumnName("UserRoleId");
|
||
|
this.Property(t => t.UserId).HasColumnName("UserId");
|
||
|
this.Property(t => t.RoleId).HasColumnName("RoleId");
|
||
|
}
|
||
|
}
|
||
|
}
|