mirror of
https://gitee.com/dotnetchina/OpenAuth.Net.git
synced 2025-09-19 10:08:04 +08:00
统一处理多对多表映射
This commit is contained in:
@@ -1,25 +0,0 @@
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Data.Entity.ModelConfiguration;
|
||||
using OpenAuth.Domain;
|
||||
|
||||
namespace OpenAuth.Repository.Models.Mapping
|
||||
{
|
||||
public class ModuleRoleMap : EntityTypeConfiguration<ModuleRole>
|
||||
{
|
||||
public ModuleRoleMap()
|
||||
{
|
||||
// Primary Key
|
||||
this.HasKey(t => t.Id);
|
||||
|
||||
// Properties
|
||||
// Table & Column Mappings
|
||||
this.ToTable("ModuleRole");
|
||||
this.Property(t => t.Id).HasColumnName("Id");
|
||||
this.Property(t => t.RoleId).HasColumnName("RoleId");
|
||||
this.Property(t => t.ModuleId).HasColumnName("ModuleId");
|
||||
this.Property(t => t.Type).HasColumnName("Type");
|
||||
this.Property(t => t.OperateTime).HasColumnName("OperateTime");
|
||||
this.Property(t => t.OperatorId).HasColumnName("OperatorId");
|
||||
}
|
||||
}
|
||||
}
|
35
OpenAuth.Repository/Models/Mapping/RelevanceMap.cs
Normal file
35
OpenAuth.Repository/Models/Mapping/RelevanceMap.cs
Normal file
@@ -0,0 +1,35 @@
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Data.Entity.ModelConfiguration;
|
||||
using OpenAuth.Domain;
|
||||
|
||||
namespace OpenAuth.Repository.Models.Mapping
|
||||
{
|
||||
public class RelevanceMap : EntityTypeConfiguration<Relevance>
|
||||
{
|
||||
public RelevanceMap()
|
||||
{
|
||||
// Primary Key
|
||||
this.HasKey(t => t.Id);
|
||||
|
||||
// Properties
|
||||
this.Property(t => t.Description)
|
||||
.IsRequired()
|
||||
.HasMaxLength(100);
|
||||
|
||||
this.Property(t => t.Key)
|
||||
.IsRequired()
|
||||
.HasMaxLength(100);
|
||||
|
||||
// Table & Column Mappings
|
||||
this.ToTable("Relevance");
|
||||
this.Property(t => t.Id).HasColumnName("Id");
|
||||
this.Property(t => t.FirstId).HasColumnName("FirstId");
|
||||
this.Property(t => t.SecondId).HasColumnName("SecondId");
|
||||
this.Property(t => t.Description).HasColumnName("Description");
|
||||
this.Property(t => t.Key).HasColumnName("Key");
|
||||
this.Property(t => t.Status).HasColumnName("Status");
|
||||
this.Property(t => t.OperateTime).HasColumnName("OperateTime");
|
||||
this.Property(t => t.OperatorId).HasColumnName("OperatorId");
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,25 +0,0 @@
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Data.Entity.ModelConfiguration;
|
||||
using OpenAuth.Domain;
|
||||
|
||||
namespace OpenAuth.Repository.Models.Mapping
|
||||
{
|
||||
public class UserModuleMap : EntityTypeConfiguration<UserModule>
|
||||
{
|
||||
public UserModuleMap()
|
||||
{
|
||||
// Primary Key
|
||||
this.HasKey(t => t.Id);
|
||||
|
||||
// Properties
|
||||
// Table & Column Mappings
|
||||
this.ToTable("UserModule");
|
||||
this.Property(t => t.Id).HasColumnName("Id");
|
||||
this.Property(t => t.UserId).HasColumnName("UserId");
|
||||
this.Property(t => t.ModuleId).HasColumnName("ModuleId");
|
||||
this.Property(t => t.Type).HasColumnName("Type");
|
||||
this.Property(t => t.OperateTime).HasColumnName("OperateTime");
|
||||
this.Property(t => t.OperatorId).HasColumnName("OperatorId");
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,24 +0,0 @@
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Data.Entity.ModelConfiguration;
|
||||
using OpenAuth.Domain;
|
||||
|
||||
namespace OpenAuth.Repository.Models.Mapping
|
||||
{
|
||||
public class UserOrgMap : EntityTypeConfiguration<UserOrg>
|
||||
{
|
||||
public UserOrgMap()
|
||||
{
|
||||
// Primary Key
|
||||
this.HasKey(t => t.Id);
|
||||
|
||||
// Properties
|
||||
// Table & Column Mappings
|
||||
this.ToTable("UserOrg");
|
||||
this.Property(t => t.Id).HasColumnName("Id");
|
||||
this.Property(t => t.OrgId).HasColumnName("OrgId");
|
||||
this.Property(t => t.UserId).HasColumnName("UserId");
|
||||
this.Property(t => t.OperateTime).HasColumnName("OperateTime");
|
||||
this.Property(t => t.OperatorId).HasColumnName("OperatorId");
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,24 +0,0 @@
|
||||
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
|
||||
// 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