Admin.Core/src/platform/ZhonTai.DynamicApi/ISelectController.cs
(完整代码) 927Busing ZhonTai.DynamicApi.Attributes;
using ZhonTai.DynamicApi.Helpers;
using System;
using System.Reflection;
namespace ZhonTai.DynamicApi;
public interface ISelectController
{
bool IsController(Type type);
}
internal class DefaultSelectController : ISelectController
{
public bool IsController(Type type)
{
var typeInfo = type.GetTypeInfo();
if (!typeof(IDynamicApi).IsAssignableFrom(type) ||
!typeInfo.IsPublic || typeInfo.IsAbstract || typeInfo.IsGenericType)
{
return false;
}
var attr = ReflectionHelper.GetSingleAttributeOrDefaultByFullSearch<DynamicApiAttribute>(typeInfo);
if (attr == null)
{
return false;
}
if (ReflectionHelper.GetSingleAttributeOrDefaultByFullSearch<NonDynamicApiAttribute>(typeInfo) != null)
{
return false;
}
return true;
}
}
24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明
AI 解读
登录后可用,每次 10 积分,解读结果公开显示在下面。
还没有人解读过这个文件。
