Does strucutremap has interception capabitlities, why do i need another libratry like windsor castle for that?

StackOverflow https://stackoverflow.com/questions/17063463

Question

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

Was it helpful?

Solution

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).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top