五丰称屠宰重客户端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 

30 lines
751 B

using System;
using System.Collections.Generic;
using Forks.Utils;
namespace BO {
[AttributeUsage(AttributeTargets.Class)]
public sealed class BOClassAttribute : Attribute {
public bool Exclude { get; set; }
public static bool IsBo(Type t) {
var attr = ReflectionUtil.GetAttribute<BOClassAttribute>(t);
if (attr == null) {
return false;
}
return !attr.Exclude;
}
public static IEnumerable<Type> GetBoClasses() {
var asm = typeof(BOClassAttribute).Assembly;
foreach (var t in asm.GetExportedTypes()) {
if (t.IsAbstract) {
continue;
}
if (t.IsClass && IsBo(t)) {
yield return t;
}
}
}
}
}