服务端的TigerApi 框架,基于.NET6 2024 版本
Rodney Chen
2024-09-25 ab6b24d4a57611605781457faede959ea3163125
Tiger.Api/Controllers/Base/SystemController.cs
@@ -7,6 +7,10 @@
using Rhea.Common;
using Tiger.IBusiness;
using System.Threading;
using System.Linq;
using Tiger.Model;
using System.Xml.Linq;
using System.ComponentModel;
namespace Tiger.Api.Controllers.Base
{
@@ -95,6 +99,38 @@
        }
        /// <summary>
        /// 获取Api产品
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        [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.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
            {
                Total = entitys.Count,
                Data = entitys.Select(q => new
                {
                    q.FullName,
                    q.Namespace,
                    q.Name,
                    DisplayName = (q.GetCustomAttribute(typeof(DisplayNameAttribute)) as DisplayNameAttribute)?.DisplayName,
                    Properties = q.GetProperties().Select(p => new {
                        p.Name,
                        DisplayName = (p.GetCustomAttribute(typeof(DisplayNameAttribute)) as DisplayNameAttribute)?.DisplayName,
                        Type = p.PropertyType.Name }).ToList()
                })
            };
            return Ok(data);
        }
        /// <summary>
        /// GetCertification(ApiAction)
        /// 在注册表HKEY_LOCAL_MACHINE\SOFTWARE\TigerClouds节点中读取密钥证书
        /// </summary>