예제 #1
0
        private void AddAdvices(CrossCutterN.Aspect.Aspect.IAspectBuilder aspect, IAdviceUtility utility, string defaultAdviceAssemblyKey)
        {
            foreach (var adviceEntry in Advices)
            {
                var index             = adviceEntry.Value;
                var adviceAssemblyKey = index.AdviceAssemblyKey;
                if (string.IsNullOrWhiteSpace(adviceAssemblyKey))
                {
                    adviceAssemblyKey = defaultAdviceAssemblyKey;
                }

                if (string.IsNullOrWhiteSpace(adviceAssemblyKey))
                {
                    throw new ApplicationException($"{adviceEntry.Key}: advice assembly key is empty");
                }

                if (string.IsNullOrWhiteSpace(index.MethodKey))
                {
                    throw new ApplicationException($"{adviceEntry.Key}: method key is empty");
                }

                var methodInfo = utility.GetMethod(adviceAssemblyKey, index.MethodKey);
                if (methodInfo == null)
                {
                    throw new ApplicationException($"Method doesn't exist: assembly key = {adviceAssemblyKey}, method key = {index.MethodKey}");
                }

                aspect.SetAdvice(adviceEntry.Key, methodInfo);
            }
        }
예제 #2
0
 private void SetAspectSwitchStatus(CrossCutterN.Aspect.Aspect.IAspectBuilder aspect)
 {
     aspect.IsSwitchedOn = IsSwitchedOn;
 }