internal TopMethodInterceptionAspectWeaver(IMethodAspectDefinition aspectDefinition, IAspectWeavingSettings aspectWeavingSettings, FieldInfo weavedType)
            : base(aspectDefinition, aspectWeavingSettings, weavedType)
        {
            IMethodScopeWeaver getReturnValueWeaver = null;
            var @params = aspectDefinition.Member.GetParameters();
            var byRefArgumentsStoreWeaver = aspectWeavingSettings.ByRefArgumentsStoreWeaver;

            if (argumentsWeavingSettings.IsFunction()) {
                getReturnValueWeaver = new TopGetReturnValueWeaver(aspectWeavingSettings, argumentsWeavingSettings);
            }

            argumentsWeavingSettings.Parameters = @params.ToArray(@param => @param.ParameterType);
            argumentsWeavingSettings.BindingsDependency = weavedType;
            argumentsWeaver = new TopMethodInterceptionArgumentsWeaver(aspectDefinition.Member, argumentsWeavingSettings, aspectWeavingSettings);

            if (!byRefArgumentsStoreWeaver.ContainsByRefParams) {
                if (getReturnValueWeaver.IsNotNull()) {
                    methodScopeWeavers.Add(getReturnValueWeaver);
                }

                weaver = new MethodScopeWeaversQueue(methodScopeWeavers);
            }
            else {
                Action<ILGenerator> storeArgsIfNeededAction = byRefArgumentsStoreWeaver.StoreArgsIfNeeded;
                var finallyWeavers = new[] { storeArgsIfNeededAction.ToMethodScopeWeaver() };

                weaver = new TryFinallyAspectWeaver(methodScopeWeavers, finallyWeavers, getReturnValueWeaver);
            }
        }
Exemple #2
0
        internal TopMethodInterceptionAspectWeaver(IMethodAspectDefinition aspectDefinition, IAspectWeavingSettings aspectWeavingSettings, FieldInfo weavedType)
            : base(aspectDefinition, aspectWeavingSettings, weavedType)
        {
            IMethodScopeWeaver getReturnValueWeaver = null;
            var @params = aspectDefinition.Member.GetParameters();
            var byRefArgumentsStoreWeaver = aspectWeavingSettings.ByRefArgumentsStoreWeaver;

            if (argumentsWeavingSettings.IsFunction())
            {
                getReturnValueWeaver = new TopGetReturnValueWeaver(aspectWeavingSettings, argumentsWeavingSettings);
            }

            argumentsWeavingSettings.Parameters         = @params.ToArray(@param => @param.ParameterType);
            argumentsWeavingSettings.BindingsDependency = weavedType;
            argumentsWeaver = new TopMethodInterceptionArgumentsWeaver(aspectDefinition.Member, argumentsWeavingSettings, aspectWeavingSettings);

            if (!byRefArgumentsStoreWeaver.ContainsByRefParams)
            {
                if (getReturnValueWeaver.IsNotNull())
                {
                    methodScopeWeavers.Add(getReturnValueWeaver);
                }

                weaver = new MethodScopeWeaversQueue(methodScopeWeavers);
            }
            else
            {
                Action <ILGenerator> storeArgsIfNeededAction = byRefArgumentsStoreWeaver.StoreArgsIfNeeded;
                var finallyWeavers = new[] { storeArgsIfNeededAction.ToMethodScopeWeaver() };

                weaver = new TryFinallyAspectWeaver(methodScopeWeavers, finallyWeavers, getReturnValueWeaver);
            }
        }
 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);
 }
Exemple #4
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 TopBindingOnMethodBoundaryAspectWeaver(IAspectWeaver nestedWeaver, IMethodAspectDefinition aspectDefinition, IAspectWeavingSettings settings)
            : base(nestedWeaver, aspectDefinition, settings)
        {
            var @params = aspectDefinition.Member.GetParameters();

            argumentsWeavingSettings.Parameters = @params.ToArray(@param => @param.ParameterType);
            argumentsWeaver = new TopBindingOnMethodExecutionArgumentsWeaver(aspectDefinition.Member, argumentsWeavingSettings, settings);
        }
Exemple #6
0
 internal TopSetPropertyInterceptionAspectWeaver(IPropertyAspectDefinition aspectDefinition, IAspectWeavingSettings aspectWeavingSettings, FieldInfo weavedType)
     : base(aspectDefinition, aspectWeavingSettings, weavedType)
 {
     argumentsWeavingSettings.BindingsDependency = weavedType;
     argumentsWeavingSettings.Parameters         = new[] { aspectDefinition.Member.PropertyType };
     argumentsWeaver = new TopSetPropertyInterceptionArgumentsWeaver(aspectDefinition.Member, argumentsWeavingSettings, aspectWeavingSettings);
     weaver          = new MethodScopeWeaversQueue(methodScopeWeavers);
 }
 internal TopSetPropertyInterceptionAspectWeaver(IPropertyAspectDefinition aspectDefinition, IAspectWeavingSettings aspectWeavingSettings, FieldInfo weavedType)
     : base(aspectDefinition, aspectWeavingSettings, weavedType)
 {
     argumentsWeavingSettings.BindingsDependency = weavedType;
     argumentsWeavingSettings.Parameters = new[] { aspectDefinition.Member.PropertyType };
     argumentsWeaver = new TopSetPropertyInterceptionArgumentsWeaver(aspectDefinition.Member, argumentsWeavingSettings, aspectWeavingSettings);
     weaver = new MethodScopeWeaversQueue(methodScopeWeavers);
 }
        internal TopBindingOnMethodBoundaryAspectWeaver(IAspectWeaver nestedWeaver, IMethodAspectDefinition aspectDefinition, IAspectWeavingSettings settings)
            : base(nestedWeaver, aspectDefinition, settings)
        {
            var @params = aspectDefinition.Member.GetParameters();

            argumentsWeavingSettings.Parameters = @params.ToArray(@param => @param.ParameterType);
            argumentsWeaver = new TopBindingOnMethodExecutionArgumentsWeaver(aspectDefinition.Member, argumentsWeavingSettings, settings);
        }
 internal TopBindingMethodInterceptionAspectWeaver(IMethodAspectDefinition aspectDefinition, IAspectWeavingSettings aspectWeavingSettings, FieldInfo weavedType)
     : base(aspectDefinition, aspectWeavingSettings, weavedType)
 {
     argumentsWeavingSettings.BindingsDependency = weavedType;
     argumentsWeaver = new TopBindingMethodInterceptionArgumentsWeaver(aspectDefinition.Member, argumentsWeavingSettings, aspectWeavingSettings);
     methodScopeWeavers.Add(new TopAspectArgsMappingWeaverImpl(aspectWeavingSettings, argumentsWeavingSettings));
     ArgumentType = argumentsWeavingSettings.ArgumentType;
     weaver = new MethodScopeWeaversQueue(methodScopeWeavers);
 }
 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);
 }
 internal TopBindingMethodInterceptionAspectWeaver(IMethodAspectDefinition aspectDefinition, IAspectWeavingSettings aspectWeavingSettings, FieldInfo weavedType)
     : base(aspectDefinition, aspectWeavingSettings, weavedType)
 {
     argumentsWeavingSettings.BindingsDependency = weavedType;
     argumentsWeaver = new TopBindingMethodInterceptionArgumentsWeaver(aspectDefinition.Member, argumentsWeavingSettings, aspectWeavingSettings);
     methodScopeWeavers.Add(new TopAspectArgsMappingWeaverImpl(aspectWeavingSettings, argumentsWeavingSettings));
     ArgumentType = argumentsWeavingSettings.ArgumentType;
     weaver       = new MethodScopeWeaversQueue(methodScopeWeavers);
 }
        internal TopOnMethodBoundaryAspectWeaver(IAspectWeaver nestedWeaver, IMethodAspectDefinition aspectDefinition, IAspectWeavingSettings aspectWeavingSettings)
            : base(nestedWeaver, aspectDefinition, aspectWeavingSettings)
        {
            var @params = aspectDefinition.Member.GetParameters();

            methodScopeWeavers = new List<IMethodScopeWeaver>();
            argumentsWeavingSettings.Parameters = @params.ToArray(@param => @param.ParameterType).ToArray();
            argumentsWeaver = new TopOnMethodBoundaryArgumentsWeaver(aspectDefinition.Member, argumentsWeavingSettings, aspectWeavingSettings);
        }
 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);
 }
        internal TopOnMethodBoundaryAspectWeaver(IAspectWeaver nestedWeaver, IMethodAspectDefinition aspectDefinition, IAspectWeavingSettings aspectWeavingSettings)
            : base(nestedWeaver, aspectDefinition, aspectWeavingSettings)
        {
            var @params = aspectDefinition.Member.GetParameters();

            methodScopeWeavers = new List <IMethodScopeWeaver>();
            argumentsWeavingSettings.Parameters = @params.ToArray(@param => @param.ParameterType).ToArray();
            argumentsWeaver = new TopOnMethodBoundaryArgumentsWeaver(aspectDefinition.Member, argumentsWeavingSettings, aspectWeavingSettings);
        }
Exemple #15
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);
 }
 internal BindingMethodInterceptionAspectWeaver(Type topAspectInScopeArgType, IMethodAspectDefinition aspectDefinition, IAspectWeavingSettings aspectWeavingSettings, FieldInfo weavedType)
     : base(aspectDefinition, aspectWeavingSettings, weavedType)
 {
     this.topAspectInScopeArgType = topAspectInScopeArgType;
     ArgumentType = argumentsWeavingSettings.ArgumentType;
     argumentsWeavingSettings.BindingsDependency = weavedType;
     argumentsWeaver = new BindingMethodInterceptionArgumentsWeaver(aspectDefinition.Member, topAspectInScopeArgType, argumentsWeavingSettings, aspectWeavingSettings);
     methodScopeWeavers.Add(new NestedAspectArgsMappingWeaver(topAspectInScopeArgType, aspectWeavingSettings, argumentsWeavingSettings));
     weaver = new MethodScopeWeaversQueue(methodScopeWeavers);
 }
 internal BindingMethodInterceptionAspectWeaver(Type topAspectInScopeArgType, IMethodAspectDefinition aspectDefinition, IAspectWeavingSettings aspectWeavingSettings, FieldInfo weavedType)
     : base(aspectDefinition, aspectWeavingSettings, weavedType)
 {
     this.topAspectInScopeArgType = topAspectInScopeArgType;
     ArgumentType = argumentsWeavingSettings.ArgumentType;
     argumentsWeavingSettings.BindingsDependency = weavedType;
     argumentsWeaver = new BindingMethodInterceptionArgumentsWeaver(aspectDefinition.Member, topAspectInScopeArgType, argumentsWeavingSettings, aspectWeavingSettings);
     methodScopeWeavers.Add(new NestedAspectArgsMappingWeaver(topAspectInScopeArgType, aspectWeavingSettings, argumentsWeavingSettings));
     weaver = new MethodScopeWeaversQueue(methodScopeWeavers);
 }
Exemple #18
0
        internal MethodDecoratorScopeWeaver(MethodInfo method, IAspectWeavingSettings aspectWeavingSettings)
            : base(method, aspectWeavingSettings.WeavingSettings)
        {
            Type aspectArgumentContract = null;
            var  localBuilderRepository = aspectWeavingSettings.LocalBuilderRepository;

            this.method               = method;
            aspectArgumentContract    = method.ToAspectArgumentContract();
            byRefArgumentsStoreWeaver = new MethodDecoratorByRefArgumentsStoreWeaver(aspectArgumentContract, method, localBuilderRepository);
            argumentsWeaver           = new MethodDecoratorArgumentsWeaver(method, byRefArgumentsStoreWeaver);
        }
        internal BindingSetPropertyInterceptionAspectWeaver(IPropertyAspectDefinition aspectDefinition, IAspectWeavingSettings aspectWeavingSettings, FieldInfo weavedType)
            : base(aspectDefinition, aspectWeavingSettings, weavedType)
        {
            IMethodScopeWeaver finallyWeaver = null;

            argumentsWeavingSettings.BindingsDependency = weavedType;
            argumentsWeavingSettings.Parameters         = new[] { aspectDefinition.Member.PropertyType };
            finallyWeaver   = new FinallyBindingPropertyAspectWeaver(aspectDefinition.Member, argumentsWeavingSettings, aspectWeavingSettings);
            argumentsWeaver = new BindingSetPropertyInterceptionArgumentsWeaver(aspectDefinition.Member, argumentsWeavingSettings, aspectWeavingSettings);
            weaver          = new TryFinallyAspectWeaver(methodScopeWeavers, new[] { finallyWeaver });
        }
        internal MethodDecoratorScopeWeaver(MethodInfo method, IAspectWeavingSettings aspectWeavingSettings)
            : base(method, aspectWeavingSettings.WeavingSettings)
        {
            Type aspectArgumentContract = null;
            var localBuilderRepository = aspectWeavingSettings.LocalBuilderRepository;

            this.method = method;
            aspectArgumentContract = method.ToAspectArgumentContract();
            byRefArgumentsStoreWeaver = new MethodDecoratorByRefArgumentsStoreWeaver(aspectArgumentContract, method, localBuilderRepository);
            argumentsWeaver = new MethodDecoratorArgumentsWeaver(method, byRefArgumentsStoreWeaver);
        }
        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);
        }
        internal BindingSetPropertyInterceptionAspectWeaver(IPropertyAspectDefinition aspectDefinition, IAspectWeavingSettings aspectWeavingSettings, FieldInfo weavedType)
            : base(aspectDefinition, aspectWeavingSettings, weavedType)
        {
            IMethodScopeWeaver finallyWeaver = null;

            argumentsWeavingSettings.BindingsDependency = weavedType;
            argumentsWeavingSettings.Parameters = new[] { aspectDefinition.Member.PropertyType };
            finallyWeaver = new FinallyBindingPropertyAspectWeaver(aspectDefinition.Member, argumentsWeavingSettings, aspectWeavingSettings);
            argumentsWeaver = new BindingSetPropertyInterceptionArgumentsWeaver(aspectDefinition.Member, argumentsWeavingSettings, aspectWeavingSettings);
            weaver = new TryFinallyAspectWeaver(methodScopeWeavers, new[] { finallyWeaver });
        }
Exemple #23
0
        internal MethodDecoratorScopeWeaver(IAspectWeavingSettings aspectWeavingSettings)
            : base(aspectWeavingSettings.WeavingSettings)
        {
            Type aspectArgumentContract = null;
            var  localBuilderRepository = aspectWeavingSettings.LocalBuilderRepository;
            var  weavingSettings        = aspectWeavingSettings.WeavingSettings;

            this.aspectWeavingSettings = aspectWeavingSettings;
            methodInfoImpl             = aspectWeavingSettings.WeavingSettings.MethodInfoImpl;
            aspectArgumentContract     = methodInfoImpl.ToAspectArgumentContract();
            byRefArgumentsStoreWeaver  = new MethodDecoratorByRefArgumentsStoreWeaver(aspectArgumentContract, methodInfoImpl, localBuilderRepository);
            argumentsWeaver            = new MethodDecoratorArgumentsWeaver(methodInfoImpl, byRefArgumentsStoreWeaver);
        }
        internal BindingMethodInterceptionAspectWeaver(IAspectDefinition aspectDefinition, IAspectWeavingSettings aspectWeavingSettings, FieldInfo weavedType)
            : base(aspectDefinition, aspectWeavingSettings, weavedType)
        {
            argumentsWeavingSetings.BindingsDependency = weavedType;
            argumentsWeaver = new BindingMethodInterceptionArgumentsWeaver(argumentsWeavingSetings, aspectWeavingSettings);

            if (argumentsWeavingSetings.IsFunction)
            {
                methodScopeWeavers.Add(new FunctionAspectArgsMappingWeaver(aspectWeavingSettings, argumentsWeavingSetings));
            }
            else
            {
                methodScopeWeavers.Add(new ActionAspectArgsMappingWeaver(aspectWeavingSettings, argumentsWeavingSetings));
            }

            ArgumentType = argumentsWeavingSetings.ArgumentType;
            weaver       = new MethodScopeWeaversQueue(methodScopeWeavers);
        }
Exemple #25
0
        internal NestedMethodInterceptionAspectWeaver(Type previousAspectArgType, IAspectDefinition aspectDefinition, IAspectWeavingSettings aspectWeavingSettings, FieldInfo weavedType)
            : base(aspectDefinition, aspectWeavingSettings, weavedType)
        {
            var argumentWeavingSettings = aspectDefinition.ToArgumentsWeavingSettings();

            argumentWeavingSettings.BindingsDependency = weavedType;
            argumentsWeaver = new NestedMethodIntercpetionArgumentsWeaver(previousAspectArgType, aspectWeavingSettings, argumentWeavingSettings);

            if (argumentsWeavingSetings.IsFunction)
            {
                methodScopeWeavers.Add(new NestedFunctionAspectArgsMappingWeaver(previousAspectArgType, aspectWeavingSettings, argumentsWeavingSetings));
            }
            else
            {
                methodScopeWeavers.Add(new NestedActionAspectArgsMappingWeaver(previousAspectArgType, aspectWeavingSettings, argumentsWeavingSetings));
            }

            weaver = new MethodScopeWeaversQueue(methodScopeWeavers);
        }
 internal SetPropertyDecoratorScopeWeaver(PropertyInfo property, IAspectWeavingSettings aspectWeavingSettings)
     : base(property.GetSetMethod(), aspectWeavingSettings.WeavingSettings)
 {
     argumentsWeaver = new PropertyDecoratorArgumentsWeaver();
 }
 internal SetPropertyDecoratorScopeWeaver(PropertyInfo property, IAspectWeavingSettings aspectWeavingSettings)
     : base(property.GetSetMethod(), aspectWeavingSettings.WeavingSettings)
 {
     argumentsWeaver = new PropertyDecoratorArgumentsWeaver();
 }