Пример #1
0
        private void SetMenuDetail(Type t)
        {
            MenuDetailAttribute menuattr = t?.GetCustomAttribute <MenuDetailAttribute>();
            MenuDetailModel     menu     = menuattr?.GetModel();

            if (menu == null)
            {
                return;
            }
            menu.Namespace = t.Namespace;
            if (m_menu.ContainsKey(menu.Id))
            {
                if (m_menu[menu.Id] == menu)
                {
                    return;
                }
                throw new Exception($"{menu.Name}的Id值与{m_menu[menu.Id].Name}中的Id值重复");
            }
            m_controller.Add(t.FullName, menu);
            m_menu.Add(menu.Id, menu);
            if (!m_menupid.TryGetValue(menu.Pid, out HashSet <int> pids))
            {
                pids = new HashSet <Int32>();
                m_menupid.Add(menu.Pid, pids);
            }
            pids.Add(menu.Id);
            SetActionDetail(t, menu.Id);
        }
Пример #2
0
 public Boolean Equals(MenuDetailAttribute attribute)
 {
     if (ReferenceEquals(attribute, null))
     {
         return(false);
     }
     return(attribute.GetModel().Id == this.m_model.Id);
 }
Пример #3
0
        public override bool Equals(object obj)
        {
            MenuDetailAttribute attribute = obj as MenuDetailAttribute;

            return(Equals(attribute));
        }