using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; namespace CK.SCP.Models.AppBoxEntity { public class Menu : ICustomTree, IKeyID, ICloneable { [Key] public int ID { get; set; } [Required, StringLength(50)] public string Name { get; set; } [StringLength(200)] public string ImageUrl { get; set; } [StringLength(200)] public string NavigateUrl { get; set; } [StringLength(500)] public string Remark { get; set; } [Required] public int SortIndex { get; set; } public virtual Menu Parent { get; set; } public virtual ICollection Children { get; set; } public virtual Power ViewPower {get; set;} /// /// 菜单在树形结构中的层级(从0开始) /// [NotMapped] public int TreeLevel { get; set; } /// /// 是否可用(默认true),在模拟树的下拉列表中使用 /// [NotMapped] public bool Enabled { get; set; } /// /// 是否叶子节点(默认true) /// [NotMapped] public bool IsTreeLeaf { get; set; } public object Clone() { Menu menu = new Menu { ID = ID, Name = Name, ImageUrl = ImageUrl, NavigateUrl = NavigateUrl, Remark = Remark, SortIndex = SortIndex, TreeLevel = TreeLevel, Enabled = Enabled, IsTreeLeaf = IsTreeLeaf }; return menu; } } }