Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我需要检查名称以“Repository”结尾的类型是否派生自名为“DefaultRepositoryBase”的基类。
我已经搜索过,但我无法找到如何从已知类型中获取 IType...我怎样才能实现这一点,然后将其传递给 t.DerivesFrom(itype)
from t in Application.Types where t.NameLike("Repository") select t
你可以写
t.DerivesFrom("Namespace.TypeName")
或者你可以写类似
let baseType = Application.Types.WithFullName("Namespace.TypeName").Single() ... t.DerivesFrom(baseType)