Chaining containers with StructureMap
Asked Answered
F

1

3

Is it possible to link containers together in StructureMap like it is in WindsorContainer.AddChildContainer()?

I want to achieve having 3 container levels; - 1 page request level - 1 session level - 1 application level

These would then be chained together so only one instance request would be made to the "base level" container.

The levels of container are unimportant really, just whether there is the ability to link them together.

Forewoman answered 3/12, 2008 at 12:48 Comment(0)
F
1

This seems to do the trick, not sure if there is a better way or what the implications are. So far looks ok...

childContainer.PluginGraph.Registries.ForEach(
  registry => parentContainer.Configure(expression => expression.AddRegistry(registry))
);

where parentContainer & childContainer are both StructureMap.Container

Forewoman answered 3/12, 2008 at 15:15 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.