Reputation: 40062
I have a similar setup shown in this question and was wondering if I could replace all my code that uses reflection to find plugins of a certain type and then does a CreateInstance
on it with a IOC Container that does something like:
builder.RegisterAssemblyTypes(typeof(MyType).Assembly)
Upvotes: 3
Views: 457
Reputation: 233307
Yes, you could do something like this:
builder.RegisterAssemblyTypes(typeof(MyType).Assembly).AsImplementedInterfaces();
Upvotes: 1