0

does strucutremap has interception capabitlities, why do i need another library like windsor castle for that? is there a native way from structuremap to do that?

AOP Logging with StructureMap is a similar question but the answer resides back to a castle proxy.

thanks

Community
  • 1
  • 1
Tiju John
  • 933
  • 11
  • 28
  • All IOC frameworks use the same open source Castle.Proxy2 library. Castle Windsor also depends on Castle.Proxy2, so in a sense Windsor neither has 'native' support. – Steven Jun 12 '13 at 10:50
  • yes.. now its castle.core – Tiju John Jun 12 '13 at 12:06
  • So what's the problem? StructureMap didn't built its own interception library, because there already was a great interception library available and reused it. The native way to do this with structure map is by using Castle.Proxy2. – Steven Jun 12 '13 at 13:18

1 Answers1

0

The documentation answers this:

StructureMap 2.5+ added the ability to postprocess or even intercept and replace the objects being created. While StructureMap will never include its own Aspect Oriented Programming model (the world does not need a new one), the interception techniques shown below could be used to apply runtime AOP from existing AOP tools like the Policy Injection Application Block from Microsoft.

In general, interception is specified in three ways:

1) OnCreation() -- Registers an Action to run against the new object after creation

2) EnrichWith() -- Registers a Func that runs against the new object after creation and gives you the option of returning a different object than the original object

3) A custom class that implements the TypeInterceptor interface (the runtime model behind all the interception techniques)

So in short StructureMap's interception capabilities deals with manipulating/replacing configured objects in the container - not applying AOP style interception.

So to summarize:

does strucutremap has interception capabitlities

Yes, but not for AOP-style interception

why do i need another library like windsor castle for that?

Because AOP is not in scope for the StructureMap architecture. There are already multiple good solutions (including Castle Proxy).

PHeiberg
  • 29,411
  • 6
  • 59
  • 81