(精華)2020年6月26日 C#類庫model TableInfo

愚公搬程式碼發表於2020-06-26
namespace Coldairarrow.Util
{
    /// <summary>
    /// 資料庫表資訊
    /// </summary>
    public class TableInfo
    {
        /// <summary>
        /// 欄位Id
        /// </summary>
        public int ColumnId { get; set; }

        /// <summary>
        /// 欄位名
        /// </summary>
        public string Name { get; set; }

        /// <summary>
        /// 欄位型別
        /// </summary>
        public string Type { get; set; }

        /// <summary>
        /// 是否為主鍵
        /// </summary>
        public bool IsKey { get; set; }

        /// <summary>
        /// 是否為空
        /// </summary>
        public bool IsNullable { get; set; }

        /// <summary>
        /// 欄位描述說明
        /// </summary>
        public string Description
        {
            get
            {
                return _description.IsNullOrEmpty() ? Name : _description;
            }
            set
            {
                _description = value;
            }
        }

        private string _description { get; set; }
    }
}

相關文章