Esempio n. 1
0
        public override async Task InterceptAsync(InterceptContext context, AsyncInterceptDelegate nextAsync)
        {
            Console.WriteLine("Async Begin");
            await nextAsync(context);

            Console.WriteLine("Async End");
        }
Esempio n. 2
0
 public TestSumServiceProxy(IInterceptDelegateBuilder builder)
 {
     sumMethod      = typeof(TestSumService).GetMethod("SumAsync", new Type[] { typeof(int), typeof(int) });
     sumInterceptor = builder.BuildAsyncInterceptDelegate(sumMethod, async c =>
     {
         c.Result = await base.SumAsync((int)c.Parameters[0], (int)c.Parameters[1]);
     });
 }
Esempio n. 3
0
            public override async Task InterceptAsync(InterceptContext context, AsyncInterceptDelegate nextAsync)
            {
                await nextAsync(context);

                context.Result = (int)context.Result + 1;
            }
 public AsyncInterceptDelegate BuildAsyncInterceptDelegate(MethodInfo methodInfo, AsyncInterceptDelegate func)
 {
     return(asyncCache.GetOrAdd(methodInfo, (m) =>
     {
         var asyncFunc = func;
         var builders = boxs.Where(i => i.Verifier(m))
                        .Select(i => i.Interceptor)
                        .OrderByDescending(i => i.Order)
                        .Select <IInterceptor, Func <AsyncInterceptDelegate, AsyncInterceptDelegate> >(i => next => async c => await i.InterceptAsync(c, next));
         foreach (var builder in builders)
         {
             asyncFunc = builder(asyncFunc);
         }
         return asyncFunc;
     }));
 }
Esempio n. 5
0
 public abstract Task InterceptAsync(InterceptContext context, AsyncInterceptDelegate nextAsync);
Esempio n. 6
0
 public override async Task InterceptAsync(InterceptContext context, AsyncInterceptDelegate nextAsync)
 {
     throw new NotImplementedException();
 }