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

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

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

有帮助吗?

解决方案

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

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top