Get the IType from a known type

55 Views Asked by At

I need to check if the types that have the name terminating with "Repository" derives from a base class called "DefaultRepositoryBase".

I've searched but I' ve not been able to find how to get the IType from a known type...how can I achieve this and then pass it to the t.DerivesFrom(itype)

from  t in Application.Types
where t.NameLike("Repository")
select t
1

There are 1 best solutions below

0
Patrick from NDepend team On BEST ANSWER

You can write

t.DerivesFrom("Namespace.TypeName")

or you can write something like

let baseType = Application.Types.WithFullName("Namespace.TypeName").Single()
...
t.DerivesFrom(baseType)