in client/Apache.ShenYu.Client/Services/ShenYuClientAttrService.cs [33:65]
public static List<ShenYuClientAttrModel> GetShenYuClientAttrClassList()
{
List<ShenYuClientAttrModel> list = new List<ShenYuClientAttrModel>();
var typeArray = AppDomainUtils.LocalAssemblies.Select(m => m.GetTypes().Where(t =>
t.IsClass
&& !t.IsAbstract
&& !t.GetTypeInfo().IsGenericTypeDefinition
&& t.GetCustomAttributes<ShenyuClientAttribute>().Any()))
.Where(m => m.Count() > 0);
foreach (var types in typeArray)
{
//select all methods
foreach (var type in types)
{
ShenYuClientAttrModel shenYuClientAttrModel = new ShenYuClientAttrModel();
shenYuClientAttrModel.ClientAttrClass = type;
shenYuClientAttrModel.ClientAttr = type.GetCustomAttribute<ShenyuClientAttribute>();
var actions = type.GetMethods().Where(method => method.IsPublic
&& method.GetCustomAttributes(typeof(ShenyuClientAttribute), true).Any());
if (actions.Any())
{
shenYuClientAttrModel.MethodClientAttrList = new List<ShenyuClientAttribute>();
foreach (var method in actions)
{
var attrShenYuMethod = method.GetCustomAttribute<ShenyuClientAttribute>();
shenYuClientAttrModel.MethodClientAttrList.Add(attrShenYuMethod);
}
}
list.Add(shenYuClientAttrModel);
}
}
return list;
}