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 InsertCacheInterceptorAttribute : AbstractInterceptorAttribute { public InsertCacheInterceptorAttribute() { } 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(false)); pipeline.AddValue(new UpdateEntityCacheValue()); pipeline.AddValue(new AopEndPipeValue()); await pipeline.Start(pipeContext); } } }