using HealthMonitor.Core.Pipeline.Aop; namespace HealthMonitor.Core.Pipeline { public class AopCachePipeline : IPipeline { private readonly IList> _values; public AopCachePipeline() { _values = new List>(); } public void AddValue(IValue v) { var lastValue = _values.LastOrDefault(); if (lastValue != null) lastValue.Next = v; _values.Add(v); } public async Task Start(CacheInterceptorContext context) { try { var firstValue = _values.FirstOrDefault(); if (firstValue != null) await firstValue.Invoke(context); } catch (AssertValidException) { await context.AopDelegate(context.AopContext); } } } }