I have a scenario where there are multiple classes that implement the same interface. the consuming class is to get all the interface implementations as a list so that it can invoke method on all the instances.
public interface IDoSomething
{
void Do();
}
public class Dance : IDoSomething
{
public void Do() { }
}
public class Eat : IDoSomething
{
public void Do() { }
}
public class Person
{
public Person(IEnumerable<IDoSomething> actions)
{
foreach (IDoSomething ds in actions)
{
ds.Do();
}
}
}
How do I register the types so that class Person can resolve all the types that implement IDoSomething
. This was possible with Unity, MEF and Spring.NET IOC containers. Trying to do the same with Dry IOC.