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.Update; namespace HealthMonitor.Core.Aop { [AttributeUsage(AttributeTargets.Method, Inherited = false)] public class UpdateCacheInterceptorAttribute : AbstractInterceptorAttribute { public UpdateCacheInterceptorAttribute() { } public async override Task Invoke(AspectContext context, AspectDelegate next) { var pipeContext = new CacheInterceptorContext() { AopContext = context, AopDelegate = next, Logger = context.ServiceProvider.GetService>()! }; var pipeline = new AopCachePipeline(); pipeline.AddValue(new AssertValidUpdateValue()); //pipeline.AddValue(new TryModifyRefManagerValue(true)); pipeline.AddValue(new UpdateEntityCacheValue()); pipeline.AddValue(new AopEndPipeValue()); await pipeline.Start(pipeContext); } } }