⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 articleclass.cs

📁 如果不使用IIS,请先运行 XSP.exe,待提示已侦听 8080端口后
💻 CS
字号:
using System;
using System.Collections.Generic;
using System.Web;
using Castle.ActiveRecord;
using Castle.ActiveRecord.Queries;
using Castle.Components.Validator;
using NHibernate.Expression;

namespace DNNLite.DesktopModules.Article
{

    /// <summary>
    ///ArticleClass 发布内容实体类
    /// </summary>
    [ActiveRecord( DynamicUpdate=true )]
    public class ArticleClass
        : ActiveRecordValidationBase<ArticleClass>
    {
        private int _id;

        [PrimaryKey( PrimaryKeyType.Native )]
        public int Id
        {
            get { return _id; }
            set { _id = value; }
        }

        private string _name ;
        /// <summary>
        /// 分类名称
        /// </summary>
        [Property(NotNull=true,Unique=true  ),ValidateNonEmpty("分类名称不能为空"),ValidateIsUnique("分类名称不能重复")]
        public string Name { get { return _name; } set { _name=value  ;} }

        private string _ename;
        /// <summary>
        /// 分类英文名(编码)
        /// </summary>
        [Property(NotNull = true, Unique = true), ValidateNonEmpty("分类英文名/编码不能为空"), ValidateIsUnique("分类英文名/编码不能重复")]
        public string EName { get { return _ename; } set { _ename = value; } }


        private int _sortnum;
        /// <summary>
        /// 排序号(同一级别下按此号码排序,如果相同按ID排)
        /// </summary>
        [Property()]
        public int SortNum { get { return _sortnum; } set { _sortnum=value  ;} }


        private ArticleClass _parent;
        /// <summary>
        /// 上级分类
        /// </summary>
        [BelongsTo()]
        public ArticleClass Parent { get { return _parent; } set {_parent=value  ;} }


        private int _level;

        /// <summary>
        /// 分类级数
        /// </summary>
        [Property("[Level]")]
        public int Level { get { return _level; } set { _level=value  ;} }


        private IList<ArticleClass> _childs=new List<ArticleClass>();
        /// <summary>
        /// 下级分类
        /// </summary>
        [HasMany(typeof(ArticleClass),BatchSize=5, Lazy=true,OrderBy="SortNum,Id Asc"  ) ]
        public IList<ArticleClass> Childs
        {
            get { return _childs; }
            set { _childs = value; }
        }


        //private IList<Article> _articles = new List<Article>();
        ///// <summary>
        ///// 包含内容
        ///// </summary>
        //[HasAndBelongsToMany(typeof(Article), Lazy=true,BatchSize=10,
        //     Table="ArticleRefClass",
        //     ColumnKey="ArticleClass",ColumnRef="Article" )]
        //public IList<Article> Articles
        //{
        //    get { return _articles; }
        //    set { _articles = value; }
        //}

    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -