Пример #1
0
 protected AbstractAdviceWeaver(IAdviceWeavingSettings adviceWeavingSettings)
 {
     aspectType               = adviceWeavingSettings.AspectType;
     aspectRepository         = adviceWeavingSettings.AspectRepository;
     localBuilderRepository   = adviceWeavingSettings.LocalBuilderRepository;
     argumentsWeavingSettings = adviceWeavingSettings.ArgumentsWeavingSettings;
 }
Пример #2
0
 protected AbstractAdviceWeaver(IAdviceWeavingSettings adviceWeavingSettings)
 {
     aspectType = adviceWeavingSettings.AspectType;
     aspectRepository = adviceWeavingSettings.AspectRepository;
     localBuilderRepository = adviceWeavingSettings.LocalBuilderRepository;
     argumentsWeavingSettings = adviceWeavingSettings.ArgumentsWeavingSettings;
 }
        internal BindingMethodAspectDecoratorWeaver(IMethodAspectDefinition aspectDefinition, IAspectWeavingSettings aspectWeavingSettings, IArgumentsWeavingSettings argumentsWeavingSettings)
            : base(aspectDefinition.Member, aspectWeavingSettings.WeavingSettings)
        {
            var bindingSettings = aspectDefinition.ToBindingSettings();

            methodDecoratorScopeWeaver = new MethodDecoratorScopeWeaver(aspectDefinition.Member, aspectWeavingSettings);
            weaver = new MethodDecoratorBindingWeaver(aspectDefinition.Member, bindingSettings, aspectWeavingSettings, this);
        }
 internal NestedMethodInvokerAspectWeaver(MethodInfo method, Type topAspectInScopeArgType, IAspectWeavingSettings aspectWeavingSettings, IArgumentsWeavingSettings argumentsWeavingSettings)
     : base(method, aspectWeavingSettings.WeavingSettings)
 {
     this.topAspectInScopeArgType = topAspectInScopeArgType;
     this.aspectWeavingSettings = aspectWeavingSettings;
     byRefArgumentStoreWeaver = aspectWeavingSettings.ByRefArgumentsStoreWeaver;
     argumentsWeaver = new NestedMethodInvokerArgumentsWeaver(method, topAspectInScopeArgType, aspectWeavingSettings, argumentsWeavingSettings);
 }
Пример #5
0
 internal AdviceWeavingSettings(IAspectWeavingSettings aspectWeavingSettings, IArgumentsWeavingSettings argumentsWeavingSettings)
 {
     AspectType = argumentsWeavingSettings.AspectType;
     ArgumentsWeavingSettings = argumentsWeavingSettings;
     WeavingSettings          = aspectWeavingSettings.WeavingSettings;
     AspectRepository         = aspectWeavingSettings.AspectRepository;
     AspectArgsMapper         = aspectWeavingSettings.AspectArgsMapper;
     LocalBuilderRepository   = aspectWeavingSettings.LocalBuilderRepository;
 }
Пример #6
0
 internal MethodInvokerAspectWeaver(Type topAspectInScopeArgType, IMethodAspectDefinition aspectDefinition, IAspectWeavingSettings aspectWeavingSettings, IArgumentsWeavingSettings argumentsWeavingSettings)
     : base(aspectDefinition.Member, aspectWeavingSettings.WeavingSettings)
 {
     this.topAspectInScopeArgType = topAspectInScopeArgType;
     this.argumentsWeavingSettings = argumentsWeavingSettings;
     localBuilderRepository = aspectWeavingSettings.LocalBuilderRepository;
     byRefArgumentStoreWeaver = aspectWeavingSettings.ByRefArgumentsStoreWeaver;
     argumentsWeaver = new MethodInvokerArgumentsWeaver(aspectDefinition.Member, topAspectInScopeArgType, aspectWeavingSettings, argumentsWeavingSettings, byRefArgumentStoreWeaver);
 }
Пример #7
0
 internal AdviceWeavingSettings(IAspectWeavingSettings aspectWeavingSettings, IArgumentsWeavingSettings argumentsWeavingSettings)
 {
     AspectType = argumentsWeavingSettings.AspectType;
     ArgumentsWeavingSettings = argumentsWeavingSettings;
     WeavingSettings = aspectWeavingSettings.WeavingSettings;
     AspectRepository = aspectWeavingSettings.AspectRepository;
     AspectArgsMapper = aspectWeavingSettings.AspectArgsMapper;
     LocalBuilderRepository = aspectWeavingSettings.LocalBuilderRepository;
 }
 internal NestedMethodInvokerAspectWeaver(Type previousAspectArgType, IAspectWeavingSettings aspectWeavingSettings, IArgumentsWeavingSettings argumentsWeavingSettings)
     : base(aspectWeavingSettings.WeavingSettings)
 {
     this.previousAspectArgType    = previousAspectArgType;
     this.aspectWeavingSettings    = aspectWeavingSettings;
     this.argumentsWeavingSettings = argumentsWeavingSettings;
     byRefArgumentStoreWeaver      = aspectWeavingSettings.ByRefArgumentsStoreWeaver;
     argumentsWeaver = new NestedMethodInvokerArgumentsWeaver(previousAspectArgType, aspectWeavingSettings, argumentsWeavingSettings);
 }
Пример #9
0
 internal MethodInvokerAspectWeaver(Type topAspectInScopeArgType, IMethodAspectDefinition aspectDefinition, IAspectWeavingSettings aspectWeavingSettings, IArgumentsWeavingSettings argumentsWeavingSettings)
     : base(aspectDefinition.Member, aspectWeavingSettings.WeavingSettings)
 {
     this.topAspectInScopeArgType  = topAspectInScopeArgType;
     this.argumentsWeavingSettings = argumentsWeavingSettings;
     localBuilderRepository        = aspectWeavingSettings.LocalBuilderRepository;
     byRefArgumentStoreWeaver      = aspectWeavingSettings.ByRefArgumentsStoreWeaver;
     argumentsWeaver = new MethodInvokerArgumentsWeaver(aspectDefinition.Member, topAspectInScopeArgType, aspectWeavingSettings, argumentsWeavingSettings, byRefArgumentStoreWeaver);
 }
Пример #10
0
        internal MethodInvokerAspectWeaver(Type previousAspectArgsType, IAspectDefinition aspectDefinition, IAspectWeavingSettings aspectWeavingSettings, IArgumentsWeavingSettings argumentsWeavingSettings)
            : base(aspectWeavingSettings.WeavingSettings)
        {
            var methodInfoImpl = aspectWeavingSettings.WeavingSettings.MethodInfoImpl;

            this.previousAspectArgsType   = previousAspectArgsType;
            this.argumentsWeavingSettings = argumentsWeavingSettings;
            localBuilderRepository        = aspectWeavingSettings.LocalBuilderRepository;
            byRefArgumentStoreWeaver      = new MethodInvokerByRefArgumentsWeaver(previousAspectArgsType, methodInfoImpl, localBuilderRepository);
            argumentsWeaver = new MethodInvokerArgumentsWeaver(previousAspectArgsType, aspectWeavingSettings, argumentsWeavingSettings, byRefArgumentStoreWeaver);
        }
Пример #11
0
 internal AbstractArgumentsWeaver(IArgumentsWeavingSettings argumentsWeavingSettings, IAspectWeavingSettings aspectWeavingSettings)
 {
     ReturnType             = argumentsWeavingSettings.ReturnType;
     AspectType             = argumentsWeavingSettings.AspectType;
     Parameters             = new Type[argumentsWeavingSettings.Parameters.Length];
     LocalBuilderRepository = aspectWeavingSettings.LocalBuilderRepository;
     ArgumentType           = argumentsWeavingSettings.ArgumentType;
     argumentsWeavingSettings.Parameters.CopyTo(Parameters, 0);
     IsFunction = argumentsWeavingSettings.IsFunction;
     this.aspectWeavingSettings = aspectWeavingSettings;
     WeavingSettings            = aspectWeavingSettings.WeavingSettings;
     BindingsDependency         = argumentsWeavingSettings.BindingsDependency;
 }
Пример #12
0
 internal AbstractArgumentsWeaver(TMember member, IArgumentsWeavingSettings argumentsWeavingSettings, IAspectWeavingSettings aspectWeavingSettings)
 {
     MemberInfo             = Member = member;
     ReturnType             = argumentsWeavingSettings.ReturnType;
     AspectType             = argumentsWeavingSettings.AspectType;
     Parameters             = new Type[argumentsWeavingSettings.Parameters.Length];
     LocalBuilderRepository = aspectWeavingSettings.LocalBuilderRepository;
     ArgumentType           = argumentsWeavingSettings.ArgumentType;
     HasReturnType          = argumentsWeavingSettings.HasReturnType;
     MemberType             = argumentsWeavingSettings.MemberType;
     argumentsWeavingSettings.Parameters.CopyTo(Parameters, 0);
     this.aspectWeavingSettings = aspectWeavingSettings;
     WeavingSettings            = aspectWeavingSettings.WeavingSettings;
     BindingsDependency         = argumentsWeavingSettings.BindingsDependency;
 }
Пример #13
0
        internal AspectExpressionTreeBuilder(IAspectDefinitionCollection aspectDefinitions)
        {
            var aspectVisitor = new AspectVisitor();
            IAspectDefinition               lastAspectDefinition     = null;
            IAspectExpressionBuilder        invocationAspectBuilder  = null;
            IArgumentsWeavingSettings       argumentsWeavingSettings = null;
            List <IAspectExpressionBuilder> aspectExpressionBuilders = null;

            var aspectsByPriority = aspectDefinitions.OrderBy(aspect => aspect.Aspect.AspectPriority)
                                    .ThenBy(aspect => {
                var value = aspect.Aspect is OnMethodBoundaryAspectAttribute;
                return(Convert.ToInt32(!value));
            });

            lastAspectDefinition     = aspectDefinitions.First();
            argumentsWeavingSettings = lastAspectDefinition.ToArgumentsWeavingSettings();
            aspectExpressionBuilders = aspectsByPriority.ToList(definition => definition.BuildAdvices().Accept(aspectVisitor));
            invocationAspectBuilder  = aspectVisitor.VisitLast(lastAspectDefinition, argumentsWeavingSettings);
            aspectExpressionBuilders.Add(invocationAspectBuilder);
            aspectsStack = new Stack <IAspectExpressionBuilder>(aspectExpressionBuilders);
        }
Пример #14
0
 internal MethodInvokerAspectExpression(IMethodAspectDefinition aspectDefinition, IArgumentsWeavingSettings argumentsWeavingSettings, IMethodAspectDefinition topAspectInScopeDefinition)
 {
     this.aspectDefinition           = aspectDefinition;
     this.argumentsWeavingSettings   = argumentsWeavingSettings;
     this.topAspectInScopeDefinition = topAspectInScopeDefinition;
 }
Пример #15
0
 internal NestedMethodInvokerAspectWeaver(MethodInfo method, Type topAspectInScopeArgType, IAspectWeavingSettings aspectWeavingSettings, IArgumentsWeavingSettings argumentsWeavingSettings)
     : base(method, aspectWeavingSettings.WeavingSettings)
 {
     this.topAspectInScopeArgType = topAspectInScopeArgType;
     this.aspectWeavingSettings   = aspectWeavingSettings;
     byRefArgumentStoreWeaver     = aspectWeavingSettings.ByRefArgumentsStoreWeaver;
     argumentsWeaver = new NestedMethodInvokerArgumentsWeaver(method, topAspectInScopeArgType, aspectWeavingSettings, argumentsWeavingSettings);
 }
 internal TopGetPropertyInterceptionArgumentsWeaver(PropertyInfo property, IArgumentsWeavingSettings argumentWeavingSettings, IAspectWeavingSettings aspectWeavingSettings)
     : base(property, argumentWeavingSettings, aspectWeavingSettings)
 {
 }
Пример #17
0
 internal BindingSetPropertyInterceptionArgumentsWeaver(PropertyInfo property, IArgumentsWeavingSettings argumentWeavingSettings, IAspectWeavingSettings aspectWeavingSettings)
     : base(property, argumentWeavingSettings, aspectWeavingSettings)
 {
 }
 internal AbstractBindingOnMethodExecutionArgumentsWeaver(MethodInfo method, IArgumentsWeavingSettings argumentWeavingSettings, IAspectWeavingSettings aspectWeavingSettings)
     : base(method, argumentWeavingSettings, aspectWeavingSettings)
 {
 }
 internal NestedMethodInvokerAspectExpression(IArgumentsWeavingSettings argumentsWeavingSettings, IMethodAspectDefinition topAspectInScopeDefinition)
 {
     this.topAspectInScopeDefinition = topAspectInScopeDefinition;
     this.argumentsWeavingSettings = argumentsWeavingSettings;
 }
Пример #20
0
 internal TopGetReturnValueWeaver(IAspectWeavingSettings aspectWeavingSettings, IArgumentsWeavingSettings argumentsWeavingSetings)
     : base(aspectWeavingSettings, argumentsWeavingSetings)
 {
 }
        internal BindingMethodAspectDecoratorWeaver(IMethodAspectDefinition aspectDefinition, IAspectWeavingSettings aspectWeavingSettings, IArgumentsWeavingSettings argumentsWeavingSettings)
            : base(aspectDefinition.Member, aspectWeavingSettings.WeavingSettings)
        {
            var bindingSettings = aspectDefinition.ToBindingSettings();

            methodDecoratorScopeWeaver = new MethodDecoratorScopeWeaver(aspectDefinition.Member, aspectWeavingSettings);
            weaver = new MethodDecoratorBindingWeaver(aspectDefinition.Member, bindingSettings, aspectWeavingSettings, this);
        }
 internal AbstractTopAspectArgumentsWeaver(IArgumentsWeavingSettings argumentWeavingSettings, IAspectWeavingSettings aspectWeavingSettings)
     : base(argumentWeavingSettings, aspectWeavingSettings)
 {
 }
 internal BindingMethodInterceptionArgumentsWeaver(MethodInfo method, Type topAspectInScopeArgType, IArgumentsWeavingSettings argumentWeavingSettings, IAspectWeavingSettings aspectWeavingSettings)
     : base(method, argumentWeavingSettings, aspectWeavingSettings)
 {
     this.topAspectInScopeArgType = topAspectInScopeArgType;
 }
 internal BindingMethodAspectDecoratorExpression(IMethodAspectDefinition aspectDefinition, IArgumentsWeavingSettings argumentsWeavingSettings)
 {
     this.aspectDefinition = aspectDefinition;
     bindingSettings = aspectDefinition.ToBindingSettings();
     this.argumentsWeavingSettings = argumentsWeavingSettings;
 }
Пример #25
0
 internal BindingAspectDecoratorExpression(IAspectDefinition aspectDefinition, IArgumentsWeavingSettings argumentsWeavingSettings)
 {
     this.aspectDefinition         = aspectDefinition;
     bindingSettings               = aspectDefinition.ToBindingSettings();
     this.argumentsWeavingSettings = argumentsWeavingSettings;
 }
 internal AbstractTopPropertyAspectArgumentsWeaver(PropertyInfo property, IArgumentsWeavingSettings argumentWeavingSettings, IAspectWeavingSettings aspectWeavingSettings)
     : base(property, argumentWeavingSettings, aspectWeavingSettings)
 {
     IsProperty         = true;
     bindingsDependency = argumentWeavingSettings.BindingsDependency;
 }
 internal TopOnMethodBoundaryArgumentsWeaver(MethodInfo method, IArgumentsWeavingSettings argumentWeavingSettings, IAspectWeavingSettings aspectWeavingSettings)
     : base(method, argumentWeavingSettings, aspectWeavingSettings)
 {
 }
 internal FinallyBindingPropertyAspectWeaver(PropertyInfo property, IArgumentsWeavingSettings argumentsWeavingSettings, IAspectWeavingSettings aspectWeavingSettings)
 {
     this.property = property;
     this.aspectWeavingSettings = aspectWeavingSettings;
     this.argumentsWeavingSettings = argumentsWeavingSettings;
 }
Пример #29
0
 internal TopMethodInterceptionArgumentsWeaver(IArgumentsWeavingSettings argumentWeavingSettings, IAspectWeavingSettings aspectWeavingSettings)
     : base(argumentWeavingSettings, aspectWeavingSettings)
 {
 }
 internal BindingOnMethodExecutionArgumentsWeaver(IArgumentsWeavingSettings argumentWeavingSettings, IAspectWeavingSettings aspectWeavingSettings)
     : base(argumentWeavingSettings, aspectWeavingSettings)
 {
 }
 internal BindingEventInterceptionArgumentsWeaver(IEventAspectDefinition aspectDefinition, IArgumentsWeavingSettings argumentWeavingSettings, IAspectWeavingSettings aspectWeavingSettings, BindingSettings bindingSettings)
     : base(aspectDefinition, argumentWeavingSettings, aspectWeavingSettings, bindingSettings)
 {
 }
Пример #32
0
 internal TopEventInterceptionArgumentsWeaver(IEventAspectDefinition aspectDefinition, IArgumentsWeavingSettings argumentWeavingSettings, IAspectWeavingSettings aspectWeavingSettings, BindingSettings bindingSettings)
     : base(aspectDefinition, argumentWeavingSettings, aspectWeavingSettings, bindingSettings)
 {
 }
 internal AbstractTopAspectPropertyArgumentsWeaver(PropertyInfo property, IArgumentsWeavingSettings argumentWeavingSettings, IAspectWeavingSettings aspectWeavingSettings)
     : base(property, argumentWeavingSettings, aspectWeavingSettings)
 {
 }
Пример #34
0
 internal TopBindingMethodInterceptionArgumentsWeaver(MethodInfo method, IArgumentsWeavingSettings argumentWeavingSettings, IAspectWeavingSettings aspectWeavingSettings)
     : base(method, argumentWeavingSettings, aspectWeavingSettings)
 {
 }
 internal BindingOnMethodExecutionArgumentsWeaver(MethodInfo method, Type topAspectInScopeArgType, IArgumentsWeavingSettings argumentWeavingSettings, IAspectWeavingSettings aspectWeavingSettings)
     : base(method, argumentWeavingSettings, aspectWeavingSettings)
 {
     this.topAspectInScopeArgType = topAspectInScopeArgType;
 }
Пример #36
0
        public IAspectExpressionBuilder VisitLast(IAspectDefinition aspectDefinition, IArgumentsWeavingSettings argumentsWeavingSettings)
        {
            Func<IAspectExpression, IAspectExpression> expressionFactory = null;
            var methodAspectDefinition = aspectDefinition as IMethodAspectDefinition;

            if (lastAspect.IsInBinding) {
                if (topAspectInScopeDefinition.AspectType == AspectType.MethodInterceptionAspect) {
                    expressionFactory = expression => {
                        return new BindingMethodAspectDecoratorExpression(methodAspectDefinition, argumentsWeavingSettings);
                    };
                }
                else if (topAspectInScopeDefinition.IsPropertyAspectDefinition()) {
                    var propertyAspectDefinition = (IPropertyAspectDefinition)topAspectInScopeDefinition;

                    expressionFactory = expression => {
                        if (topAspectInScopeDefinition.IsGetPropertyAspectDefinition()) {
                            return new BindingGetPropertyAspectDecoratorExpression(propertyAspectDefinition);
                        }

                        return new BindingSetPropertyAspectDecoratorExpression(propertyAspectDefinition);
                    };
                }
                else if (topAspectInScopeDefinition.IsEventAspectDefinition()) {
                    var eventAspectDefinition = (IEventAspectDefinition)topAspectInScopeDefinition;

                    if (topAspectInScopeDefinition.AspectType == AspectType.AddEventInterceptionAspect) {
                        expressionFactory = expression => {
                            return new BindingAddEventAspectDecoratorExpression(eventAspectDefinition);
                        };
                    }
                    else if (topAspectInScopeDefinition.AspectType == AspectType.RemoveEventInterceptionAspect) {
                        expressionFactory = expression => {
                            return new BindingRemoveEventAspectDecoratorExpression(eventAspectDefinition);
                        };
                    }
                    else {
                        expressionFactory = expression => {
                            return new BindingRaiseEventAspectDecoratorExpression(eventAspectDefinition);
                        };
                    }
                }
                else {
                    expressionFactory = expression => {
                        return new MethodInvokerAspectExpression(methodAspectDefinition, argumentsWeavingSettings, (IMethodAspectDefinition)topAspectInScopeDefinition);
                    };
                }
            }
            else {
                expressionFactory = expression => {
                    return new NestedMethodInvokerAspectExpression(argumentsWeavingSettings, (IMethodAspectDefinition)topAspectInScopeDefinition);
                };
            }

            return new AspectNodeExpressionBuilder(expressionFactory);
        }
 internal TopBindingMethodInterceptionArgumentsWeaver(MethodInfo method, IArgumentsWeavingSettings argumentWeavingSettings, IAspectWeavingSettings aspectWeavingSettings)
     : base(method, argumentWeavingSettings, aspectWeavingSettings)
 {
 }
 internal AbstractBindingMethodInterceptionArgumentsWeaver(MethodInfo method, IArgumentsWeavingSettings argumentWeavingSettings, IAspectWeavingSettings aspectWeavingSettings)
     : base(method, argumentWeavingSettings, aspectWeavingSettings)
 {
     bindingsDependency = argumentWeavingSettings.BindingsDependency;
 }
 internal BindingMethodInterceptionArgumentsWeaver(IArgumentsWeavingSettings argumentWeavingSettings, IAspectWeavingSettings aspectWeavingSettings)
     : base(argumentWeavingSettings, aspectWeavingSettings)
 {
     bindingsDependency = argumentWeavingSettings.BindingsDependency;
 }
Пример #40
0
        internal BindingAspectDecoratorWeaver(IAspectDefinition aspectDefinition, IAspectWeavingSettings aspectWeavingSettings, IArgumentsWeavingSettings argumentsWeavingSettings)
            : base(aspectWeavingSettings.WeavingSettings)
        {
            var bindingSettings = aspectDefinition.ToBindingSettings();
            var methodInfoImpl  = aspectWeavingSettings.WeavingSettings.MethodInfoImpl;

            lazyWeavedType = new Core.Lib.Lazy <FieldInfo>(WeaveType);
            bindingSettings.LocalBuilderRepository = aspectWeavingSettings.LocalBuilderRepository;
            methodDecoratorScopeWeaver             = new MethodDecoratorScopeWeaver(aspectWeavingSettings);
            weaver = new MethodDecoratorBindingWeaver(bindingSettings, aspectWeavingSettings, this);
        }
 internal AbstractEventAspectArgumentsWeaver(IEventAspectDefinition aspectDefinition, IArgumentsWeavingSettings argumentWeavingSettings, IAspectWeavingSettings aspectWeavingSettings, BindingSettings bindingSettings)
     : base(aspectDefinition.Member, argumentWeavingSettings, aspectWeavingSettings)
 {
     this.bindingSettings  = bindingSettings;
     this.aspectDefinition = aspectDefinition;
 }
Пример #42
0
 internal AbstractGetReturnValueWeaver(IAspectWeavingSettings aspectWeavingSettings, IArgumentsWeavingSettings argumentsWeavingSetings)
 {
     this.aspectWeavingSettings = aspectWeavingSettings;
     this.argumentsWeavingSetings = argumentsWeavingSetings;
     localBuilderRepository = aspectWeavingSettings.LocalBuilderRepository;
 }
 internal AbstractTopAspectArgumentsWeaver(TMember member, IArgumentsWeavingSettings argumentWeavingSettings, IAspectWeavingSettings aspectWeavingSettings)
     : base(member, argumentWeavingSettings, aspectWeavingSettings)
 {
 }
Пример #44
0
 internal FinallyBindingPropertyAspectWeaver(PropertyInfo property, IArgumentsWeavingSettings argumentsWeavingSettings, IAspectWeavingSettings aspectWeavingSettings)
 {
     this.property = property;
     this.aspectWeavingSettings    = aspectWeavingSettings;
     this.argumentsWeavingSettings = argumentsWeavingSettings;
 }
Пример #45
0
 internal TopGetReturnValueWeaver(IAspectWeavingSettings aspectWeavingSettings, IArgumentsWeavingSettings argumentsWeavingSetings)
     : base(aspectWeavingSettings, argumentsWeavingSetings)
 {
 }