统一处理多对多表映射

This commit is contained in:
yubaolee
2015-11-30 11:58:18 +08:00
parent 92ead80909
commit 464f04bb32
36 changed files with 968 additions and 3372 deletions

View File

@@ -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");
}
}
}

View 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");
}
}
}

View File

@@ -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");
}
}
}

View File

@@ -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");
}
}
}

View File

@@ -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");
}
}
}