你的位置:首页 > 软件开发 > ASP.net > 基于页面的权限设计原形

基于页面的权限设计原形

发布时间:2015-07-09 13:00:08
权限属性定义:/// <summary> /// 权限属性 /// </summary> [AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, AllowMultiple ...

权限属性定义:

/// <summary>  /// 权限属性  /// </summary>  [AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, AllowMultiple = false, Inherited = false)]  public class AccessLevAttribute : Attribute  {    /// <summary>    /// 名称    /// </summary>    public string Name { get; set; }    /// <summary>    /// 权限    /// </summary>    public string LevStr { get; set; }    /// <summary>    ///     /// </summary>    static Type attrType = typeof(AccessLevAttribute);    public AccessLevAttribute(string name)    {      this.Name = name;    }    public AccessLevAttribute(string name, string levStr)    {      this.Name = name;      this.LevStr = levStr;    }    /// <summary>    /// 解析类属性    /// </summary>    /// <param name="t"></param>    /// <returns></returns>    public static AccessLevAttribute ParseClass(Type t)    {      return Parse(t.GetCustomAttributes(attrType, false));    }    /// <summary>    /// 解析方法属性    /// </summary>    /// <param name="m"></param>    /// <returns></returns>    public static AccessLevAttribute ParseMethod(MethodInfo m)    {      return Parse(m.GetCustomAttributes(attrType, false));    }    static AccessLevAttribute Parse(object[] attributes)    {      return (attributes == null || attributes.Length != 1) ? null : attributes[0] as AccessLevAttribute;    }  }

原标题:基于页面的权限设计原形

关键词:

*特别声明:以上内容来自于网络收集,著作权属原作者所有,如有侵权,请联系我们: admin#shaoqun.com (#换成@)。

可能感兴趣文章

我的浏览记录