mirror of
https://gitee.com/dotnetchina/OpenAuth.Net.git
synced 2026-02-17 13:49:28 +08:00
采用全新的数据库架构
This commit is contained in:
@@ -1,33 +1,27 @@
|
||||
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");
|
||||
}
|
||||
}
|
||||
}
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
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.Id);
|
||||
|
||||
// Properties
|
||||
this.Property(t => t.Id)
|
||||
.HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);
|
||||
|
||||
// Table & Column Mappings
|
||||
this.ToTable("UserRole");
|
||||
this.Property(t => t.Id).HasColumnName("Id");
|
||||
this.Property(t => t.RoleId).HasColumnName("RoleId");
|
||||
this.Property(t => t.UserId).HasColumnName("UserId");
|
||||
this.Property(t => t.OperateTime).HasColumnName("OperateTime");
|
||||
this.Property(t => t.OperatorId).HasColumnName("OperatorId");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user