| | |
| | | /// <summary> |
| | | /// 菜单 |
| | | /// </summary> |
| | | public class Menu : CommonEntity, IEntityTypeBuilder<Menu> |
| | | public class Menu : CommonEntity, IEntityTypeBuilder<Menu>, IIsDisabled |
| | | { |
| | | public Menu() |
| | | { |
| | | Childrens = []; |
| | | Children = []; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 用户类型 |
| | | /// </summary> |
| | | public EnumUserType UserType { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 客户端类型 |
| | | /// </summary> |
| | | public EnumClientType ClientType { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 上级Id |
| | |
| | | /// <summary> |
| | | /// 下级 |
| | | /// </summary> |
| | | public List<Menu> Childrens { get; set; } |
| | | public List<Menu> Children { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 菜单路径 |
| | |
| | | public bool IsDisabled { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 是否隐藏 |
| | | /// </summary> |
| | | public bool IsHidden { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 是否缓存 |
| | | /// </summary> |
| | | public bool IsCache { get; set; } |
| | |
| | | public void Configure(EntityTypeBuilder<Menu> entityBuilder, DbContext dbContext, Type dbContextLocator) |
| | | { |
| | | entityBuilder |
| | | .HasMany(x => x.Childrens) |
| | | .HasMany(x => x.Children) |
| | | .WithOne(x => x.Parent) |
| | | .HasForeignKey(x => x.ParentId) |
| | | .OnDelete(DeleteBehavior.ClientSetNull); |