调整数据库菜单表结构,可以动态加载按钮,注意更新数据库结构并重新初始化数据库

This commit is contained in:
yubaolee
2015-12-05 16:07:53 +08:00
parent 135723f563
commit af5e04d62f
16 changed files with 805 additions and 1090 deletions

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 ModuleElementGrantMap : EntityTypeConfiguration<ModuleElementGrant>
{
public ModuleElementGrantMap()
{
// Primary Key
this.HasKey(t => t.Id);
// Properties
// Table & Column Mappings
this.ToTable("ModuleElementGrant");
this.Property(t => t.Id).HasColumnName("Id");
this.Property(t => t.ElementId).HasColumnName("ElementId");
this.Property(t => t.UserId).HasColumnName("UserId");
this.Property(t => t.RoleId).HasColumnName("RoleId");
this.Property(t => t.GrantType).HasColumnName("GrantType");
}
}
}

View File

@@ -20,9 +20,25 @@ namespace OpenAuth.Repository.Models.Mapping
.IsRequired()
.HasMaxLength(255);
this.Property(t => t.Attr)
.IsRequired()
.HasMaxLength(500);
this.Property(t => t.Script)
.IsRequired()
.HasMaxLength(500);
this.Property(t => t.Icon)
.IsRequired()
.HasMaxLength(255);
this.Property(t => t.Class)
.IsRequired()
.HasMaxLength(255);
this.Property(t => t.Remark)
.IsRequired()
.HasMaxLength(4000);
.HasMaxLength(200);
// Table & Column Mappings
this.ToTable("ModuleElement");
@@ -31,6 +47,10 @@ namespace OpenAuth.Repository.Models.Mapping
this.Property(t => t.Name).HasColumnName("Name");
this.Property(t => t.Type).HasColumnName("Type");
this.Property(t => t.ModuleId).HasColumnName("ModuleId");
this.Property(t => t.Attr).HasColumnName("Attr");
this.Property(t => t.Script).HasColumnName("Script");
this.Property(t => t.Icon).HasColumnName("Icon");
this.Property(t => t.Class).HasColumnName("Class");
this.Property(t => t.Remark).HasColumnName("Remark");
}
}

View File

@@ -1,35 +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");
}
}
}
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

@@ -19,7 +19,6 @@ namespace OpenAuth.Repository.Models
public DbSet<Module> Modules { get; set; }
public DbSet<ModuleElement> ModuleElements { get; set; }
public DbSet<ModuleElementGrant> ModuleElementGrants { get; set; }
public DbSet<Org> Orgs { get; set; }
public DbSet<Relevance> Relevances { get; set; }
public DbSet<Role> Roles { get; set; }
@@ -31,7 +30,6 @@ namespace OpenAuth.Repository.Models
{
modelBuilder.Configurations.Add(new ModuleMap());
modelBuilder.Configurations.Add(new ModuleElementMap());
modelBuilder.Configurations.Add(new ModuleElementGrantMap());
modelBuilder.Configurations.Add(new OrgMap());
modelBuilder.Configurations.Add(new RelevanceMap());
modelBuilder.Configurations.Add(new RoleMap());

View File

@@ -54,7 +54,6 @@
</ItemGroup>
<ItemGroup>
<Compile Include="BaseRepository.cs" />
<Compile Include="Models\Mapping\ModuleElementGrantMap.cs" />
<Compile Include="Models\Mapping\ModuleElementMap.cs" />
<Compile Include="Models\Mapping\ModuleMap.cs" />
<Compile Include="Models\Mapping\OrgMap.cs" />