structuremap / StructureMap.DynamicInterception

OBSOLETE, see the main StructureMap repository
Apache License 2.0
3 stars 2 forks source link

Creating an Interceptor Class with a DI Dependency #7

Open dguinn-oncore opened 7 years ago

dguinn-oncore commented 7 years ago

Hey guys, this is a really great addition for structure map!

I may be missing something simple, but I can't figure out how to add an IAsyncInterceptionBehavior that requires a constructor dependency (ILogger, for example). Logging is a good example because I think that is pretty common use for dynamic proxy interception (with tracing and error handling).

Let me know if something comes to mind, or if I'm missing something pretty obvious!

Thanks!

DixonDs commented 7 years ago

@dguinn-oncore Have you tried to use DynamicProxyInterceptor(params Type[] interceptionBehaviorTypes) ctor? If you have, let's say, LoggingInterceptionBehavior with ILogger dependency, it should work if you create use new DynamicProxyInterceptor(typeof(LoggingInterceptionBehavior))

mattiasnordqvist commented 5 years ago

did this work?