unitycontainer / registration-by-convention

Unity.RegistrationByConvention package (Requires Core Implementation. Any contributors?)
Apache License 2.0
4 stars 12 forks source link

Load assemblies from base path for web applications #16

Open ArnaudB88 opened 5 years ago

ArnaudB88 commented 5 years ago

Hi,

The AllClasses.FromAssembliesInBasePath() does not work for web applications. Since all our applications (web/service/console apps) in the solution use the same container bootstrap logic, it would be nice to let the registration by convention work for all types of applications.

Second: it would be nice to increase the performance of it by providing an overload of this method which can filter the assembly names.

My suggestion is to use code from StructureMap (end-of-life DI container), more specific: The code in AllClasses.FromAssembliesInBasePath() can use the same code from: AssemblyFinder.FindAssemblies(func,func,bool)

https://github.com/structuremap/structuremap/blob/master/src/StructureMap/Graph/AssemblyFinder.cs

Result:

I think this is a quick win for this repo ;)

ENikS commented 5 years ago

Would you like to send a pull request with the implementatin?