|
- using AspectCore.DynamicProxy;
- using Microsoft.Extensions.DependencyInjection;
- using Microsoft.Extensions.Logging;
- using HealthMonitor.Core.Pipeline;
- using HealthMonitor.Core.Pipeline.Aop;
- using HealthMonitor.Core.Pipeline.Aop.Delete;
-
- namespace HealthMonitor.Core.Aop
- {
- [AttributeUsage(AttributeTargets.Method, Inherited = false)]
- public class DeleteCacheInterceptorAttribute : AbstractInterceptorAttribute
- {
- public DeleteCacheInterceptorAttribute() { }
-
- public async override Task Invoke(AspectContext context, AspectDelegate next)
- {
- var pipeContext = new CacheInterceptorContext()
- {
- AopContext = context,
- AopDelegate = next,
- Logger = context.ServiceProvider.GetService<ILogger<DeleteCacheInterceptorAttribute>>()!
- };
-
- var pipeline = new AopCachePipeline();
- pipeline.AddValue(new AssertValidDeleteValue());
- //pipeline.AddValue(new TryRemoveRefManagerValue());
- pipeline.AddValue(new DeleteEntityCacheValue());
- pipeline.AddValue(new AopEndPipeValue());
- await pipeline.Start(pipeContext);
- }
- }
- }
|