Not sure I understand completely what you're trying to do, but can't you
just do something like this?

    internal class Program {
        private static void Main(string[] args) {
            var generator = new ProxyGenerator();
            var c = generator.CreateClassProxy<AsyncClass>(new
AsyncInterceptor());
            var x = c.GetSomething().Result;
            Console.WriteLine(x);
        }
    }

    public class AsyncClass {
        public virtual async Task<string> GetSomething() {
            var h = new HttpClient();
            var response = await h.GetAsync("http://www.google.com";);
            var content = await response.Content.ReadAsStringAsync();
            return content;
        }
    }

    public class AsyncInterceptor : IInterceptor {
        public async void Intercept(IInvocation invocation) {
            invocation.Proceed();
            var result = await (Task<string>)invocation.ReturnValue;
            invocation.ReturnValue = Task.Factory.StartNew(async () => {
                var h = new HttpClient();
                var response = await h.GetAsync("http://www.bing.com";);
                var content = await response.Content.ReadAsStringAsync();
                return content + result;
            });
        }
    }

Cheers



--
Mauricio


On Wed, Jul 17, 2013 at 4:45 AM, Kristijan Horvat <khor...@icodeteam.net>wrote:

> Here is the link with more info -
> http://stackoverflow.com/questions/17663808/making-ninject-interceptors-intercept-method-an-async-method
>
>
> On Tuesday, July 16, 2013 11:08:51 PM UTC+2, Krzysztof Koźmic wrote:
>>
>> Hey,
>>
>> What specifically beyond what's already possible did you have in mind?
>>
>> @K
>>
>> --
>> Krzysztof Kozmic
>>
>>  --
> You received this message because you are subscribed to the Google Groups
> "Castle Project Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to castle-project-users+unsubscr...@googlegroups.com.
> To post to this group, send email to castle-project-users@googlegroups.com
> .
> Visit this group at http://groups.google.com/group/castle-project-users.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Castle Project Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to castle-project-users+unsubscr...@googlegroups.com.
To post to this group, send email to castle-project-users@googlegroups.com.
Visit this group at http://groups.google.com/group/castle-project-users.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to