Only search current assembly?

Oct 24, 2010 at 9:14 AM

Hi there,

 

Is it supported where you only what the search the current assembly?

 

I have found ExcludeSystemAssemblies so it won't search System assemblies but is it possible to IGNORE all assemblies and only search the current assembly?

 

Here is what i have so far.

 

_container.ConfigureAutoRegistration().ExcludeSystemAssemblies().Include(If.Implements<IConfigurator>, Then.Register().As<IConfigurator>().WithTypeName()).ApplyAutoRegistration();

Any advice really appreciated

 

Coordinator
Oct 24, 2010 at 9:30 AM

Hello,

It it possible to ignore assemblies by using ExcludeAssemblies method and specifying explicitly what assemblies you'd like to ignore.

Unfortunately currently there's no way to do it without listing all assemblies you'd like to ignore.

I'll put this as a feature request for next release.

Oct 24, 2010 at 9:45 AM

Great Artem, thanks.

 

Currently I call this in the Application_Start so it doesn't matter if it has to search through lots of assemblies as the application hasn't initialized yet..

 

Actually it seems pretty quick anyway but the feature would be a nice addition.

 

All the best

 

Jul 28, 2011 at 8:41 AM

Hi Artem,

 

I wanted to ask when the next version is planned?

 

I am currently using the followng, but i think its looking in currently assembly plus all attached assemblies in hierachy nature.

 

I had to ignore an assembly called "Vestris" as it gave me an error saying i have missing assemblies, of course i don't but its searching up the chain of all referenced assemblies in all referenced assemblies, if that makes sense

 

          this.bootContainer.ConfigureAutoRegistration().ExcludeSystemAssemblies().ExcludeAssemblies(
                    a => a.GetName().FullName.Contains("Vestris")).Include(
                        If.Implements<IConfigurator>, Then.Register().As<IConfigurator>().WithTypeName()).
                    ApplyAutoRegistration();

I thought i would post some ideas here, don't know if they can make it into the next version?

IncludeCurrentlyAssembly - Only Include currently assembly and DO NOT search any assemblies that are referenced within the currrently assembly.

and i was wondering if its possible to get back a LIST of assemblies that its going to use.... so in the place of ApplyAutoRegistration which i presume runs the process... we could have

PreviewAssemblies

or something similar that would return a IList of all assemblies that it contains..

Would be great for debugging to see what assemblies it is going to act upon before running the ApplyAutoRegistration

Thanks!


Coordinator
Aug 2, 2011 at 10:49 AM

Hello,

I don't have any exact plans for the next version yet, but happy to modify existing version or issue new one if there's enough changes.

I like your idea of IncludeCurrentAssembly, probably even making it a default option, someone else also had asked about this feature. It'll also certainly increase performance in a default scenarios.

Regarding a list of assemblies that it's going to use, for now you can just use: 

AppDomain.CurrentDomain.GetAssemblies()

that'll give you full and exact list of assemblies it'll scan (except those you exclude explicitly).

Aug 2, 2011 at 11:28 AM

Hi there,

 

Yes making it a default option would be much better i think. I am using auto registration for looking up classes that inherit a certain interface ... Its for my bootstrapper...

 

The GetAssemblies is great currently, but i think it would be much better to get auto registration to return what it wants to use before issuing the method "ApplyAutoRegistration" like a GetAssemblies but off of the autoregistration fluid interface not using the CurrentDomain.

 

Yes i would very much welcome a patch to the current version. It would certainly increase performance... The odd errors i get now and again because of the system searching hierarchically through the assemblies.

Thanks