I have a set of classes which implement a common interface and are annotated with a business domain attribute. By design, each class is annotated with different parametrization
[Foo(Bar=1)]
public class EntityA : ICustomInterface
[Foo(Bar=2)]
public class EntityB : ICustomInterface
[Foo(Bar=3)]
public class EntityC : ICustomInterface
Either From the Spring's IApplicationContext
or using plain old reflection, how do I find the class that implements ICustomInterface
and is annotated with [Foo(Bar=Y)]
?
Something like Spring for Java's getBeansWithAnnotation
. I don't require Spring.net, because those objects are prototypes. To be clear: if my task does not require using Spring at all I am happy with that
If you have obtained the Assembly, you can just iterate over the types and check for your conditions:
I am assuming you want only classes where
Foo.Bar
has the valueY
.