選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

33 行
1.2KB

  1. using AspectCore.DynamicProxy;
  2. using Microsoft.Extensions.DependencyInjection;
  3. using Microsoft.Extensions.Logging;
  4. using HealthMonitor.Core.Pipeline;
  5. using HealthMonitor.Core.Pipeline.Aop;
  6. using HealthMonitor.Core.Pipeline.Aop.Delete;
  7. namespace HealthMonitor.Core.Aop
  8. {
  9. [AttributeUsage(AttributeTargets.Method, Inherited = false)]
  10. public class DeleteCacheInterceptorAttribute : AbstractInterceptorAttribute
  11. {
  12. public DeleteCacheInterceptorAttribute() { }
  13. public async override Task Invoke(AspectContext context, AspectDelegate next)
  14. {
  15. var pipeContext = new CacheInterceptorContext()
  16. {
  17. AopContext = context,
  18. AopDelegate = next,
  19. Logger = context.ServiceProvider.GetService<ILogger<DeleteCacheInterceptorAttribute>>()!
  20. };
  21. var pipeline = new AopCachePipeline();
  22. pipeline.AddValue(new AssertValidDeleteValue());
  23. //pipeline.AddValue(new TryRemoveRefManagerValue());
  24. pipeline.AddValue(new DeleteEntityCacheValue());
  25. pipeline.AddValue(new AopEndPipeValue());
  26. await pipeline.Start(pipeContext);
  27. }
  28. }
  29. }