添加资源表/数据字典/分类

This commit is contained in:
yubaolee
2015-12-14 21:39:39 +08:00
parent 5650569fbe
commit 999046f887
24 changed files with 2724 additions and 372 deletions

View File

@@ -0,0 +1,43 @@
using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;
using OpenAuth.Domain;
namespace OpenAuth.Repository.Models.Mapping
{
public class CategoryMap : EntityTypeConfiguration<Category>
{
public CategoryMap()
{
// Primary Key
this.HasKey(t => t.Id);
// Properties
this.Property(t => t.CascadeId)
.IsRequired()
.HasMaxLength(255);
this.Property(t => t.Name)
.IsRequired()
.HasMaxLength(255);
this.Property(t => t.RootKey)
.IsRequired()
.HasMaxLength(100);
this.Property(t => t.RootName)
.IsRequired()
.HasMaxLength(200);
// Table & Column Mappings
this.ToTable("Category");
this.Property(t => t.Id).HasColumnName("Id");
this.Property(t => t.CascadeId).HasColumnName("CascadeId");
this.Property(t => t.Name).HasColumnName("Name");
this.Property(t => t.ParentId).HasColumnName("ParentId");
this.Property(t => t.Status).HasColumnName("Status");
this.Property(t => t.SortNo).HasColumnName("SortNo");
this.Property(t => t.RootKey).HasColumnName("RootKey");
this.Property(t => t.RootName).HasColumnName("RootName");
}
}
}

View File

@@ -0,0 +1,38 @@
using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;
using OpenAuth.Domain;
namespace OpenAuth.Repository.Models.Mapping
{
public class DicDetailMap : EntityTypeConfiguration<DicDetail>
{
public DicDetailMap()
{
// Primary Key
this.HasKey(t => t.Id);
// Properties
this.Property(t => t.Value)
.IsRequired()
.HasMaxLength(100);
this.Property(t => t.Text)
.IsRequired()
.HasMaxLength(100);
this.Property(t => t.Description)
.IsRequired()
.HasMaxLength(100);
// Table & Column Mappings
this.ToTable("DicDetail");
this.Property(t => t.Id).HasColumnName("Id");
this.Property(t => t.Value).HasColumnName("Value");
this.Property(t => t.Text).HasColumnName("Text");
this.Property(t => t.DicId).HasColumnName("DicId");
this.Property(t => t.SortNo).HasColumnName("SortNo");
this.Property(t => t.Status).HasColumnName("Status");
this.Property(t => t.Description).HasColumnName("Description");
}
}
}

View File

@@ -0,0 +1,37 @@
using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;
using OpenAuth.Domain;
namespace OpenAuth.Repository.Models.Mapping
{
public class DicIndexMap : EntityTypeConfiguration<DicIndex>
{
public DicIndexMap()
{
// Primary Key
this.HasKey(t => t.Id);
// Properties
this.Property(t => t.Name)
.IsRequired()
.HasMaxLength(255);
this.Property(t => t.Key)
.IsRequired()
.HasMaxLength(100);
this.Property(t => t.Description)
.IsRequired()
.HasMaxLength(200);
// Table & Column Mappings
this.ToTable("DicIndex");
this.Property(t => t.Id).HasColumnName("Id");
this.Property(t => t.Name).HasColumnName("Name");
this.Property(t => t.Key).HasColumnName("Key");
this.Property(t => t.SortNo).HasColumnName("SortNo");
this.Property(t => t.CategoryId).HasColumnName("CategoryId");
this.Property(t => t.Description).HasColumnName("Description");
}
}
}

View File

@@ -20,6 +20,10 @@ namespace OpenAuth.Repository.Models.Mapping
.IsRequired()
.HasMaxLength(255);
this.Property(t => t.Type)
.IsRequired()
.HasMaxLength(50);
this.Property(t => t.Attr)
.IsRequired()
.HasMaxLength(500);

View File

@@ -0,0 +1,38 @@
using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;
using OpenAuth.Domain;
namespace OpenAuth.Repository.Models.Mapping
{
public class ParamMap : EntityTypeConfiguration<Param>
{
public ParamMap()
{
// Primary Key
this.HasKey(t => t.Id);
// Properties
this.Property(t => t.Value)
.IsRequired()
.HasMaxLength(100);
this.Property(t => t.Key)
.IsRequired()
.HasMaxLength(100);
this.Property(t => t.Description)
.IsRequired()
.HasMaxLength(100);
// Table & Column Mappings
this.ToTable("Param");
this.Property(t => t.Id).HasColumnName("Id");
this.Property(t => t.Value).HasColumnName("Value");
this.Property(t => t.Key).HasColumnName("Key");
this.Property(t => t.CategoryId).HasColumnName("CategoryId");
this.Property(t => t.SortNo).HasColumnName("SortNo");
this.Property(t => t.Status).HasColumnName("Status");
this.Property(t => t.Description).HasColumnName("Description");
}
}
}

View File

@@ -0,0 +1,44 @@
using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;
using OpenAuth.Domain;
namespace OpenAuth.Repository.Models.Mapping
{
public class ResourceMap : EntityTypeConfiguration<Resource>
{
public ResourceMap()
{
// Primary Key
this.HasKey(t => t.Id);
// Properties
this.Property(t => t.CascadeId)
.IsRequired()
.HasMaxLength(255);
this.Property(t => t.Key)
.IsRequired()
.HasMaxLength(200);
this.Property(t => t.Name)
.IsRequired()
.HasMaxLength(255);
this.Property(t => t.Description)
.IsRequired()
.HasMaxLength(500);
// Table & Column Mappings
this.ToTable("Resource");
this.Property(t => t.Id).HasColumnName("Id");
this.Property(t => t.CascadeId).HasColumnName("CascadeId");
this.Property(t => t.Key).HasColumnName("Key");
this.Property(t => t.Name).HasColumnName("Name");
this.Property(t => t.ParentId).HasColumnName("ParentId");
this.Property(t => t.Status).HasColumnName("Status");
this.Property(t => t.SortNo).HasColumnName("SortNo");
this.Property(t => t.CategoryId).HasColumnName("CategoryId");
this.Property(t => t.Description).HasColumnName("Description");
}
}
}

View File

@@ -17,10 +17,15 @@ namespace OpenAuth.Repository.Models
{
}
public DbSet<Category> Categories { get; set; }
public DbSet<DicDetail> DicDetails { get; set; }
public DbSet<DicIndex> DicIndexes { get; set; }
public DbSet<Module> Modules { get; set; }
public DbSet<ModuleElement> ModuleElements { get; set; }
public DbSet<Org> Orgs { get; set; }
public DbSet<Param> Params { get; set; }
public DbSet<Relevance> Relevances { get; set; }
public DbSet<Resource> Resources { get; set; }
public DbSet<Role> Roles { get; set; }
public DbSet<User> Users { get; set; }
public DbSet<UserCfg> UserCfgs { get; set; }
@@ -28,10 +33,15 @@ namespace OpenAuth.Repository.Models
protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
modelBuilder.Configurations.Add(new CategoryMap());
modelBuilder.Configurations.Add(new DicDetailMap());
modelBuilder.Configurations.Add(new DicIndexMap());
modelBuilder.Configurations.Add(new ModuleMap());
modelBuilder.Configurations.Add(new ModuleElementMap());
modelBuilder.Configurations.Add(new OrgMap());
modelBuilder.Configurations.Add(new ParamMap());
modelBuilder.Configurations.Add(new RelevanceMap());
modelBuilder.Configurations.Add(new ResourceMap());
modelBuilder.Configurations.Add(new RoleMap());
modelBuilder.Configurations.Add(new UserMap());
modelBuilder.Configurations.Add(new UserCfgMap());

View File

@@ -54,10 +54,15 @@
</ItemGroup>
<ItemGroup>
<Compile Include="BaseRepository.cs" />
<Compile Include="Models\Mapping\CategoryMap.cs" />
<Compile Include="Models\Mapping\DicDetailMap.cs" />
<Compile Include="Models\Mapping\DicIndexMap.cs" />
<Compile Include="Models\Mapping\ModuleElementMap.cs" />
<Compile Include="Models\Mapping\ModuleMap.cs" />
<Compile Include="Models\Mapping\OrgMap.cs" />
<Compile Include="Models\Mapping\ParamMap.cs" />
<Compile Include="Models\Mapping\RelevanceMap.cs" />
<Compile Include="Models\Mapping\ResourceMap.cs" />
<Compile Include="Models\Mapping\RoleMap.cs" />
<Compile Include="Models\Mapping\UserCfgMap.cs" />
<Compile Include="Models\Mapping\UserExtMap.cs" />