/src/LinFu.AOP.Interfaces/CompositeAroundInvoke.cs
http://github.com/philiplaureano/LinFu · C# · 36 lines · 28 code · 7 blank · 1 comment · 4 complexity · fe422c49c7630d5604215b0fe6943334 MD5 · raw file
- using System;
- using System.Collections.Generic;
- namespace LinFu.AOP.Interfaces
- {
- internal class CompositeAroundInvoke : IAroundInvoke
- {
- private readonly IList<IAroundInvoke> _aroundInvokeList = new List<IAroundInvoke>();
- public CompositeAroundInvoke(IEnumerable<IAroundInvoke> aroundInvokeList)
- {
- if (aroundInvokeList == null)
- throw new ArgumentNullException("aroundInvokeList");
- // Filter out the null values
- foreach (var current in aroundInvokeList)
- {
- if (current == null)
- continue;
- _aroundInvokeList.Add(current);
- }
- }
- public void AfterInvoke(IInvocationInfo context, object returnValue)
- {
- foreach (var invoke in _aroundInvokeList) invoke.AfterInvoke(context, returnValue);
- }
- public void BeforeInvoke(IInvocationInfo context)
- {
- foreach (var invoke in _aroundInvokeList) invoke.BeforeInvoke(context);
- }
- }
- }