kswoll / sexy-proxy

Fody-based proxy generator with support for async patterns
29 stars 11 forks source link

Example usage with autofac #1

Open AlexKeySmith opened 8 years ago

AlexKeySmith commented 8 years ago

Hello again :-) [As a recap for anyone seeing this ticket for the first time]

This looks fantastic! A bit of a hidden gem when looking for async support for interceptors.

It would be great to see an example / extensions for autofac & interceptors so mere mortals like myself can make good use of it. :-)

Autofac has an extension package which sits onto of Dynamic Proxy to create AOP style interceptors.

This is probably a better explanation than I can give:

http://docs.autofac.org/en/latest/advanced/interceptors.html

And here is the code in the extension method that works the magic:

https://github.com/autofac/Autofac.Extras.DynamicProxy/blob/ff1822d4ffa8893dd1eac1bb674d22ccba68737d/src/Autofac.Extras.DynamicProxy/RegistrationExtensions.cs

It's a similar to ninject's extension in many ways.

AlexKeySmith commented 8 years ago

I'm going to have a play with the Autofac.Extras.DynamicProxy as on an initial scoot around there doesn't to be to many usages of the proxy, perhaps just switching out the proxy implementation and making use of your new api I might be able to do it?

How different would you say your API is to DynamicProxy (I'm sure I'll find out as I start playing, but just your general impression). :-)

kswoll commented 8 years ago

Sorry, I never saw your response! But if you mean compared to Castle's DynamicProxy it's pretty similar in its essentials.