using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Estsh.Core.CodeGenerate { public class TableInfo { /// /// 表格ID,表的名称。 /// public string TableName { get; set; } /// /// 表的别称,或者描述 /// public string Description { get; set; } /// /// 字段列表 /// public List Fileds { get; set; } /// /// 初始化 /// public TableInfo() { Fileds = new List(); } /// /// 获取主键的名称列表。 /// /// public List GetIdentityList() { var list = Fileds.Where(x => x.IsIdentity); if (list == null) return null; return list.Select(x => x.FieldName).ToList(); } /// /// 获取主键字段列表 /// /// public List GetIdentityFields() { var list = Fileds.Where(x => x.IsIdentity); if (list == null) return null; return list.ToList(); } /// /// 获取可空字段。 /// /// public List GetIsNullableFields() { var list = Fileds.Where(x => x.IsNullable); if (list == null) return null; return list.ToList(); } /// /// 获取不可空字段。 /// /// public List GetNotNullableFields() { var list = Fileds.Where(x => !x.IsNullable); if (list == null) return null; return list.ToList(); } } }