Expose a "Register(TypeFrom from, TypeTo)" overload for conventional registration?

Jul 10, 2012 at 8:01 PM

Hey,

I was hoping it might be possible to expose a Register method that overloads the generic versions, allowing to pass in an instance of type. The reason I ask, is it allows it to play nice with a sort of conventional registration approach (register all types from this assembly etc), where you don't necessarily know the type your going to be registering the component as, you just want it to do it.

Types.FromAssemblyContaining<App>()
.ForEach(type => container.Register(type.DefaultInterface(), type, LifeStyle.Singleton));

I know there is a method that has this signature already, but for some reason it's private, any chance it could be exposed?

Cheers,

Coordinator
Jul 19, 2012 at 2:50 AM

Hey - absolutely... I'll look into it tonight!

Coordinator
Jul 19, 2012 at 5:25 AM

Updated - please let me know if that works for you!

 

cheers, Ian

Sep 3, 2012 at 3:27 PM

how can I do Types.FromAssemblyContaining<App>()? is this an API from MetroIoc? Cannot find it anywhere 

Coordinator
Sep 6, 2012 at 9:37 AM

Hi Marlon,

It's not a MetroIoc piece - I assumed it was something @TheEvilDev had written...

 

Ian