fearofawhackplanet
fearofawhackplanet

Reputation: 53388

Ninject parent child container hierarchy (like inheritance)

Does Ninject have anything similar to the Unity concept of parent/child containers to provide a basic inheritance model? I googled but didn't find anything.

Upvotes: 4

Views: 2345

Answers (2)

Remo Gloor
Remo Gloor

Reputation: 32725

Ninject supports container hierarchies using https://github.com/ninject/ninject.extensions.childkernel. See also my article http://www.planetgeek.ch/2010/12/08/how-to-use-the-additional-ninject-scopes-of-namedscope/ about additional scopes for Ninject. Expecially look at the last part. Sometimes it is better using this concept rather than container heirarchies.

Upvotes: 6

Ruben Bartelink
Ruben Bartelink

Reputation: 61795

There are Activation Blocks. Not aware of specific documentation, but the Cache and Collect article has an example. I'd look in the tests for more examples.

I'm sure @Remo Gloor will be along but I believe the general attitude of the team (and original author) are that Nested Containers are A Bad Idea and hence are not likely to be supported directly in the core (but it may be via an extension - e.g., like Context Preservation

Upvotes: 2

Related Questions