|
1234567891011121314151617181920212223242526272829303132 |
- 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<ILogger<UpdateCacheInterceptorAttribute>>()!
- };
-
- 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);
- }
- }
- }
|