Unregister type from container.

Mar 17, 2010 at 8:33 PM

Is there a way to remove a type registration from an unity container?

Mar 18, 2010 at 5:19 AM

Not explicitly, the semantics of removal get messy once you dive into the details. However, depending on why you want it there's probably a way to do the right thing. Could you give more information about what you're trying to do?

 

 

Mar 25, 2010 at 2:29 PM

Ok,

I'll try to briefly explain, what I am doing. I am using the Common Service Location pattern to create a global/ambient dependency injection container.  This container is configured by what I describe as di container modules. Each assembly that has one or more di container module defined is annotated with an assembly level attribute for each di module.


To make a long story short, when this ambient container is accessed for the first time, it will find/create all di container modules in assemblies that have been marked and configure the global container with all my default implementations. 

I was just curious to see if there was a way to remove a type registration. I know this could get hairy as other types could depend on the registration that is being removed.