/// <summary> /// Gets the sequence order in which the given aspect will run. /// </summary> /// <param name="aspect">The aspect to get the sequence order of</param> public static int GetOrder(Aspect aspect) { Type aspectType = aspect.GetType(); var index = aspectsSequence.IndexOf(aspectType); if (index >= 0) { return index; } string message = string.Format("Sequence order is not specified for {0}. Please go to {1} and specify the sequence order of {0}.", aspectType.Name, MethodBase.GetCurrentMethod().DeclaringType); throw new Exception(message); }
private static string BuildConflictMessage(DuringCallbackEventArgs args, MethodBehaviors lastOption, Aspect lastAspect, Aspect currentAspect) { return string.Format( @"Two aspects requested conflicting behavior. Method:{0}.{1} Aspect {2} requested {3} Aspect {4} requested {5}", args.TypeName, args.MethodName, lastAspect.GetType().Name, lastOption, currentAspect.GetType().Name, args.MethodBehavior); }
public static void AddAspect(Aspect newAspect) { var key = GetUniqueKey(newAspect.GetType().Name); AddAspect(key, newAspect); }
public void add(Aspect aspect) { aspects.Add(aspect.GetType(), aspect); }