コード例 #1
0
ファイル: CacheAttribute.cs プロジェクト: msusur/Crowfx
 public void BeforeMethodExecuted(IMethodInvocationContext context)
 {
     ICacheManager manager = DIContainer.DefaultContainer.Resolve<ICacheManager>();
     string key = GetCacheKey(context);
     context.ReturnValue = manager.GetOrAdd<object>(key, () => context.Proceed(), TimeSpan.FromMinutes(CacheDuration));
     context.Cancel = true;
     context.IsMethodExecuted = true;
 }
コード例 #2
0
ファイル: LogAttribute.cs プロジェクト: msusur/Crowfx
 public void OnMethodExecuting(IMethodInvocationContext context)
 {
     ILog log = DIContainer.DefaultContainer.Resolve<ILog>();
     log.DebugFormat("Method: {0} is executing...", context.Method.Name);
     context.ReturnValue = context.Proceed();
     context.Cancel = true;
     log.DebugFormat("Method: {0} done executing.", context.Method.Name);
 }
コード例 #3
0
ファイル: AsyncAttribute.cs プロジェクト: msusur/Crowfx
 public void ExecuteAsync(IMethodInvocationContext context)
 {
     Task.Factory.StartNew(() => context.Proceed());
     context.Cancel = true;
 }