2015-04-15 23:57:36 +08:00
|
|
|
|
using System.Data.Entity.ModelConfiguration;
|
|
|
|
|
|
using OpenAuth.Domain;
|
2015-04-25 12:31:01 +08:00
|
|
|
|
using OpenAuth.Domain.Model;
|
2015-04-15 23:57:36 +08:00
|
|
|
|
|
2015-05-23 12:10:53 +08:00
|
|
|
|
namespace OpenAuth.Repository.Mapping
|
2015-04-15 23:57:36 +08:00
|
|
|
|
{
|
|
|
|
|
|
public class MenuMap : EntityTypeConfiguration<Menu>
|
|
|
|
|
|
{
|
|
|
|
|
|
public MenuMap()
|
|
|
|
|
|
{
|
|
|
|
|
|
// Primary Key
|
2015-05-23 12:10:53 +08:00
|
|
|
|
this.HasKey(t => t.Id);
|
2015-04-15 23:57:36 +08:00
|
|
|
|
|
|
|
|
|
|
// Properties
|
2015-05-23 12:10:53 +08:00
|
|
|
|
this.Property(t => t.Id)
|
2015-04-15 23:57:36 +08:00
|
|
|
|
.IsRequired()
|
|
|
|
|
|
.HasMaxLength(50);
|
|
|
|
|
|
|
|
|
|
|
|
this.Property(t => t.ParentId)
|
|
|
|
|
|
.HasMaxLength(50);
|
|
|
|
|
|
|
|
|
|
|
|
this.Property(t => t.FullName)
|
|
|
|
|
|
.HasMaxLength(50);
|
|
|
|
|
|
|
|
|
|
|
|
this.Property(t => t.Description)
|
|
|
|
|
|
.HasMaxLength(200);
|
|
|
|
|
|
|
|
|
|
|
|
this.Property(t => t.Img)
|
|
|
|
|
|
.HasMaxLength(50);
|
|
|
|
|
|
|
|
|
|
|
|
this.Property(t => t.NavigateUrl)
|
|
|
|
|
|
.HasMaxLength(200);
|
|
|
|
|
|
|
|
|
|
|
|
this.Property(t => t.FormName)
|
|
|
|
|
|
.HasMaxLength(200);
|
|
|
|
|
|
|
|
|
|
|
|
this.Property(t => t.Target)
|
|
|
|
|
|
.HasMaxLength(50);
|
|
|
|
|
|
|
2015-04-27 17:54:50 +08:00
|
|
|
|
//<2F>˵<EFBFBD><CBB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>İ<EFBFBD>ť
|
|
|
|
|
|
this.HasMany(t => t.Buttons)
|
|
|
|
|
|
.WithMany(b => b.Menus)
|
|
|
|
|
|
.Map(m =>
|
|
|
|
|
|
{
|
|
|
|
|
|
m.MapLeftKey("MenuId");
|
|
|
|
|
|
m.MapRightKey("ButtonId");
|
|
|
|
|
|
m.ToTable("MenuButton");
|
|
|
|
|
|
});
|
|
|
|
|
|
//TODO:<3A>˵<EFBFBD><CBB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ľ<EFBFBD>ɫ<EFBFBD><C9AB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>䣬EF<45><46>ѯʱ<D1AF><CAB1><EFBFBD>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD><EFBFBD>Role_RoleId<49><64>
|
|
|
|
|
|
this.HasMany(t => t.Roles)
|
|
|
|
|
|
.WithMany(b => b.RoleMenus)
|
|
|
|
|
|
.Map(m =>
|
|
|
|
|
|
{
|
|
|
|
|
|
m.MapLeftKey("MenuId");
|
|
|
|
|
|
m.MapRightKey("RoleId");
|
|
|
|
|
|
m.ToTable("RoleMenu");
|
|
|
|
|
|
});
|
|
|
|
|
|
|
2015-04-15 23:57:36 +08:00
|
|
|
|
// Table & Column Mappings
|
|
|
|
|
|
this.ToTable("Menu");
|
2015-05-23 12:10:53 +08:00
|
|
|
|
this.Property(t => t.Id).HasColumnName("MenuId");
|
2015-04-15 23:57:36 +08:00
|
|
|
|
this.Property(t => t.ParentId).HasColumnName("ParentId");
|
|
|
|
|
|
this.Property(t => t.FullName).HasColumnName("FullName");
|
|
|
|
|
|
this.Property(t => t.Description).HasColumnName("Description");
|
|
|
|
|
|
this.Property(t => t.Img).HasColumnName("Img");
|
|
|
|
|
|
this.Property(t => t.Category).HasColumnName("Category");
|
|
|
|
|
|
this.Property(t => t.NavigateUrl).HasColumnName("NavigateUrl");
|
|
|
|
|
|
this.Property(t => t.FormName).HasColumnName("FormName");
|
|
|
|
|
|
this.Property(t => t.Target).HasColumnName("Target");
|
|
|
|
|
|
this.Property(t => t.IsUnfold).HasColumnName("IsUnfold");
|
|
|
|
|
|
this.Property(t => t.Enabled).HasColumnName("Enabled");
|
|
|
|
|
|
this.Property(t => t.SortCode).HasColumnName("SortCode");
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|