| | |
| | | using Tiger.IBusiness; |
| | | using System.Threading; |
| | | using System.Linq; |
| | | using Tiger.Model; |
| | | using System.Xml.Linq; |
| | | |
| | | namespace Tiger.Api.Controllers.Base |
| | | { |
| | |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | [HttpGet] |
| | | [Route("System/Base/[action]")] |
| | | public IActionResult GetEntitys() |
| | | [Route("System/Entitys/Get")] |
| | | public IActionResult GetEntitys(string Namespace, string StartWith) |
| | | { |
| | | Assembly assembly = Assembly.Load("Tiger.Model"); |
| | | Type[] types = assembly.GetTypes(); |
| | | var entitys = types.Where(q => q.GetInterfaces().Contains(typeof(Model.iEntity)) && q.IsClass).ToList(); |
| | | var data = entitys.Select(q => new |
| | | var entitys = types.Where(q => q.IsClass && q.GetInterfaces().Contains(typeof(Model.iEntity)) //&& q.Namespace != "Tiger.Model.Minsun" |
| | | && (Namespace.IsNullOrEmpty() || q.Namespace == Namespace) |
| | | && (StartWith.IsNullOrEmpty() || q.Name.StartsWith(StartWith)) |
| | | && !q.GetCustomAttributes(typeof(EntityBase), false).Any()).ToList(); |
| | | var data = new |
| | | { |
| | | q.Namespace, |
| | | q.FullName, |
| | | Properties = q.GetProperties().Select(p => new { p.Name, Type = p.PropertyType.Name }).ToList() |
| | | }); |
| | | Total = entitys.Count, |
| | | Data = entitys.Select(q => new |
| | | { |
| | | q.FullName, |
| | | q.Namespace, |
| | | q.Name, |
| | | Properties = q.GetProperties().Select(p => new { p.Name, Type = p.PropertyType.Name }).ToList() |
| | | }) |
| | | }; |
| | | return Ok(data); |
| | | } |
| | | |
| | |
| | | |
| | | namespace Tiger.Model |
| | | { |
| | | |
| | | |
| | | /// <summary> |
| | | /// 数据库实体基类,包括基本字段:ID,CREATE_TIME,CREATE_USER,UPDATE_TIME,UPDATE_USER,GHOST_ROW |
| | | /// </summary> |
| | | [EntityBase] |
| | | public class DbEntity : DbEntityNoGhost, iTableHasGhost |
| | | { |
| | | #region 构造函数 |
| | |
| | | /// <summary> |
| | | /// 数据库实体基类(包含权限),包括基本字段:ID,CREATE_TIME,CREATE_USER,UPDATE_TIME,UPDATE_USER,GHOST_ROW,AUTH_ORG,AUTH_PROD,AUTH_WH |
| | | /// </summary> |
| | | [EntityBase] |
| | | public class DbEntityWithAuth : DbEntity, iTableHasAuth |
| | | { |
| | | #region 构造函数 |
| | |
| | | /// <summary> |
| | | /// 数据库实体基类(包含权限),包括基本字段:ID,CREATE_TIME,CREATE_USER,UPDATE_TIME,UPDATE_USER,AUTH_ORG,AUTH_PROD,AUTH_WH |
| | | /// </summary> |
| | | [EntityBase] |
| | | public class DbEntityNoGhostWithAuth : DbEntityNoGhost, iTableHasAuth |
| | | { |
| | | #region 构造函数 |
| | |
| | | /// <summary> |
| | | /// 数据库实体基类,包括基本字段:ID,CREATE_TIME,CREATE_USER,UPDATE_TIME,UPDATE_USER |
| | | /// </summary> |
| | | [EntityBase] |
| | | public class DbEntityNoGhost : DbEntityOnlyID, iTableHasCrUp |
| | | { |
| | | #region 构造函数 |
| | |
| | | /// <summary> |
| | | /// 数据库实体基类,包括基本字段:ID |
| | | /// </summary> |
| | | [EntityBase] |
| | | public class DbEntityOnlyID : iDBEntity, iTableHasID |
| | | { |
| | | #region 构造函数 |
| | |
| | | using System.Threading.Tasks; |
| | | |
| | | namespace Tiger.Model |
| | | { |
| | | { |
| | | /// <summary> |
| | | /// 实体基类特性 |
| | | /// </summary> |
| | | public class EntityBase : Attribute |
| | | { |
| | | public string Description { get; private set; } |
| | | |
| | | public EntityBase(string description = "") |
| | | { |
| | | Description = description; |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 实体基类接口 |
| | | /// </summary> |