コード例 #1
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);
            }
        }
コード例 #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);
            }
        }
コード例 #3
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);
 }
コード例 #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);
 }
コード例 #5
0
        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);
        }
コード例 #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);
 }
コード例 #7
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);
 }
コード例 #8
0
        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);
        }
コード例 #9
0
 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);
 }
コード例 #10
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);
 }
コード例 #11
0
 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);
 }
コード例 #12
0
        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);
        }
コード例 #13
0
 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);
 }
コード例 #14
0
        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);
        }
コード例 #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);
 }
コード例 #16
0
 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);
 }
コード例 #17
0
 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);
 }
コード例 #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);
        }
コード例 #19
0
        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 });
        }
コード例 #20
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);
        }
コード例 #21
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);
        }
コード例 #22
0
        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 });
        }
コード例 #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);
        }
コード例 #24
0
        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);
        }
コード例 #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);
        }
コード例 #26
0
 internal SetPropertyDecoratorScopeWeaver(PropertyInfo property, IAspectWeavingSettings aspectWeavingSettings)
     : base(property.GetSetMethod(), aspectWeavingSettings.WeavingSettings)
 {
     argumentsWeaver = new PropertyDecoratorArgumentsWeaver();
 }
コード例 #27
0
 internal SetPropertyDecoratorScopeWeaver(PropertyInfo property, IAspectWeavingSettings aspectWeavingSettings)
     : base(property.GetSetMethod(), aspectWeavingSettings.WeavingSettings)
 {
     argumentsWeaver = new PropertyDecoratorArgumentsWeaver();
 }