Example #1
0
        public PresentationAspect(IGenericAspect aspect)
        {
            this.Name = aspect.Name;

            foreach (AspectTarget target in aspect.Targets)
            {
                PresentationAspectTarget presTarget = new PresentationAspectTarget(this, target);
                this.Targets.Add(presTarget);
            }

            foreach (IPointcut pointcut in aspect.Pointcuts)
            {
                PresentationPointcut presPointcut = new PresentationPointcut(this, pointcut);
                this.Pointcuts.Add(presPointcut);
            }

            foreach (object mixin in aspect.Mixins)
            {
                string typeName = "";
                if (mixin is Type)
                {
                    typeName = ((Type)mixin).FullName;
                }
                else
                {
                    typeName = (string)mixin;
                }

                PresentationMixin presMixin = new PresentationMixin(this, typeName);
                this.Mixins.Add(presMixin);
            }
        }
Example #2
0
        public PresentationAspectTarget AddTypeTarget(Type type)
        {
            string typeName = type.FullName;

            foreach (PresentationAspectTarget target in Targets)
            {
                if (target.TargetType == AspectTargetType.Signature)
                {
                    if (target.Signature == typeName)
                    {
                        return(target);
                    }
                }
            }
            PresentationAspectTarget newTarget = new PresentationAspectTarget(this);

            newTarget.TargetType = AspectTargetType.Signature;
            newTarget.Signature  = typeName;
            this.Targets.Add(newTarget);
            return(newTarget);
        }