thedersen / UnityConfiguration

Convention based configuration API for the Unity IoC container.
thedersen.com/projects/unityconfiguration
MIT License
38 stars 15 forks source link

More overloads in AssemblyScanner for #1

Closed thedersen closed 13 years ago

thedersen commented 13 years ago

From Yury Shatz on blog:

May I propose a feature for UnityConfiguration? I wanted to scan all loaded assemblies but found I can't do it using the pattern shown in your example. What seems to be missing is:

interface IAssemblyScanner {... void Assembly(Assembly assembly); //same in AssemblyScanner }

In general, fully functional style is somewhat limiting. I think I understand why you did that. But it makes it harder to extend.

For instance, when I saw that I can't add assembly to registry I decided "ok, maybe I can extend IAssemblyScanner and pass my own instance". But UnityRegistry only accepts Action and creates its own scanner.

Then I thought "ok, maybe I can extend registry!" and do something like this:

x.AddRegistry(new MyRegistry(assembly1)); x.AddRegistry(new MyRegistry(assembly2));

But this is not supported too.

One level above, container can only be configured with actions (-:

Of course I can extend registry and call registry.Configure(container) directly. This is what I'll do for now.

thedersen commented 13 years ago

The 1.3 release will include several more overloads for adding assemblies to the scanner as well as a new overload for adding an instance of a registry. See the wiki for a complete list of changes.