private IClassMatcher GetClassMatcher(IAspectInfo aspect) { var key = aspect.TargetType.GetType(); if (Cache.ContainsKey(key)) { return(Cache[key]); } return(null); }
public bool Match(Type targetType, IAspectInfo aspect) { var targetInfo = aspect.TargetType as INamespaceTargetTypeInfo; if (targetInfo.Namespace != targetType.Namespace) { return(targetType.Namespace.Contains(targetInfo.Namespace)); } if (targetInfo.Excludes.Contains(targetType)) { return(false); } return(true); }
private Aspect Build(Type type, IAspectInfo info, IAspectConstruction construction, IPointcut pointcut, int priority = 0) { var scope = info.Scope; var activation = info.Activation; var role = info.Role; var orderings = new List <IOrdering>(); var crosscutting = new Crosscutting(pointcut, orderings, priority, type, role); orderings.AddRange(_orderingBuilder.BuildOrderings(crosscutting, type)); var advices = new List <Advice>(); var introductions = new List <MemberIntroduction>(); var imports = new List <MemberImport>(); var aspect = new Aspect(type, scope, activation, construction, crosscutting, advices, imports, introductions); advices.AddRange(_adviceBuilder.GetAdvices(aspect)); imports.AddRange(_interTypeBuilder.AddMemberImports(aspect)); introductions.AddRange(_interTypeBuilder.AddMemberIntroductions(aspect)); return(aspect); }
/// <summary> /// 注册切面 /// </summary> /// <param name="aspect"></param> /// <returns></returns> public IAspectRepository Register(IAspectInfo aspect) { aspects.Add(aspect); return this; }
/// <summary> /// 注册切面 /// </summary> /// <param name="aspect"></param> /// <returns></returns> public IAspectRepository Register(IAspectInfo aspect) { aspects.Add(aspect); return(this); }
protected virtual Type GetTypeToCompare(IAspectInfo aspect) { return((aspect.TargetType as ISingleTargetTypeInfo).SingleType); }
public bool Match(Type targetType, IAspectInfo aspect) { Type type = GetTypeToCompare(aspect); return(Match(targetType, type)); }