コード例 #1
0
        public override IAspectWeaver Reduce(IAspectWeavingSettings aspectWeavingSettings)
        {
            var previousAspectArgsType = previousAspectDefinition.ToAspectArgumentImpl();
            var nestedWeaver           = aspectExpression.Reduce(aspectWeavingSettings);

            return(new NestedOnMethodBoundaryAspectWeaver(previousAspectArgsType, nestedWeaver, aspectDefinition, aspectWeavingSettings));
        }
コード例 #2
0
 internal AspectArgsMethodWeaver(MethodInfo method, LocalBuilder methodLocalBuilder, Type[] parameters, IAspectWeavingSettings aspectWeavingSettings)
 {
     this.method = method;
     this.parameters = parameters;
     this.methodLocalBuilder = methodLocalBuilder;
     this.aspectWeavingSettings = aspectWeavingSettings;
 }
コード例 #3
0
 internal AbstractMethodInterceptionBindingWeaver(IAspectExpression aspectExpression, IAspectDefinition aspectDefinition, IAspectWeavingSettings aspectWeavingSettings)
     : base(aspectDefinition)
 {
     this.aspectExpression      = aspectExpression;
     this.aspectWeavingSettings = aspectWeavingSettings;
     lazyWeavedType             = new Core.Lib.Lazy <FieldInfo>(WeaveType);
 }
コード例 #4
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);
            }
        }
コード例 #5
0
        public override IAspectWeaver Reduce(IAspectWeavingSettings aspectWeavingSettings)
        {
            var topAspectInScopeArgType = topAspectInScopeDefinition.ToAspectArgumentImpl();
            var bindingWeaver = new IsolatedMethodInterceptionBindingWeaver(aspectExpression, aspectDefinition, aspectWeavingSettings);

            return new NestedMethodInterceptionAspectWeaver(topAspectInScopeArgType, aspectDefinition, aspectWeavingSettings, bindingWeaver.WeavedType);
        }
コード例 #6
0
 internal AbstractMethodInterceptionBindingWeaver(IAspectExpression aspectExpression, IMethodAspectDefinition aspectDefinition, IAspectWeavingSettings aspectWeavingSettings)
     : base(aspectDefinition)
 {
     this.aspectExpression = aspectExpression;
     this.aspectWeavingSettings = aspectWeavingSettings;
     lazyWeavedType = new Core.Lib.Lazy<FieldInfo>(WeaveType);
 }
コード例 #7
0
 internal AspectArgsMethodWeaver(MethodInfo method, LocalBuilder methodLocalBuilder, Type[] parameters, IAspectWeavingSettings aspectWeavingSettings)
 {
     this.method                = method;
     this.parameters            = parameters;
     this.methodLocalBuilder    = methodLocalBuilder;
     this.aspectWeavingSettings = aspectWeavingSettings;
 }
コード例 #8
0
 internal AbstractMethodBindingWeaver(MethodInfo method, BindingSettings bindingSettings, IAspectWeavingSettings aspectWeavingSettings, IMethodScopeWeaver methodScopeWeaver)
 {
     this.method = method;
     this.bindingSettings = bindingSettings;
     this.methodScopeWeaver = methodScopeWeaver;
     this.aspectWeavingSettings = aspectWeavingSettings;
 }
コード例 #9
0
        public override IAspectWeaver Reduce(IAspectWeavingSettings aspectWeavingSettings)
        {
            var topAspectInScopeArgType = topAspectInScopeDefinition.ToAspectArgumentImpl();
            var bindingWeaver           = new IsolatedMethodInterceptionBindingWeaver(aspectExpression, aspectDefinition, aspectWeavingSettings);

            return(new NestedMethodInterceptionAspectWeaver(topAspectInScopeArgType, aspectDefinition, aspectWeavingSettings, bindingWeaver.WeavedType));
        }
コード例 #10
0
 internal AbstractMethodBindingWeaver(MethodInfo method, BindingSettings bindingSettings, IAspectWeavingSettings aspectWeavingSettings, IMethodScopeWeaver methodScopeWeaver)
 {
     this.method                = method;
     this.bindingSettings       = bindingSettings;
     this.methodScopeWeaver     = methodScopeWeaver;
     this.aspectWeavingSettings = aspectWeavingSettings;
 }
コード例 #11
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);
 }
コード例 #12
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);
 }
コード例 #13
0
 internal BindingRemoveEventInterceptionAspectWeaver(IEventAspectDefinition aspectDefinition, IAspectWeavingSettings aspectWeavingSettings, FieldInfo weavedType)
     : base(aspectDefinition, aspectWeavingSettings, weavedType)
 {
     argumentsWeavingSettings.BindingsDependency = weavedType;
     argumentsWeavingSettings.Parameters = new[] { aspectDefinition.Member.EventHandlerType };
     argumentsWeaver = new BindingEventInterceptionArgumentsWeaver(aspectDefinition, argumentsWeavingSettings, aspectWeavingSettings, bindingSettings);
     weaver = new MethodScopeWeaversQueue(methodScopeWeavers);
 }
コード例 #14
0
 internal AbstractPropertyBindingWeaver(PropertyInfo property, BindingSettings bindingSettings, IAspectWeavingSettings aspectWeavingSettings, IMethodScopeWeaver getMethodScopeWeaver = null, IMethodScopeWeaver setMethodScopeWeaver = null)
 {
     this.property              = property;
     this.bindingSettings       = bindingSettings;
     this.getMethodScopeWeaver  = getMethodScopeWeaver;
     this.setMethodScopeWeaver  = setMethodScopeWeaver;
     this.aspectWeavingSettings = aspectWeavingSettings;
 }
コード例 #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);
 }
コード例 #16
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);
        }
コード例 #17
0
        internal CompositeRaiseEventWeaver(IEventTypeBuilder eventTypeBuilder, EventInfo @event, MethodInfo method, IAspectDefinitionCollection aspectDefinitions, IAspectWeavingSettings aspectWeavingSettings)
            : base(eventTypeBuilder, method, aspectDefinitions, aspectWeavingSettings)
        {
            var typeBuilder = (IAspectTypeDefinition)aspectWeavingSettings.WeavingSettings.TypeDefinition;
            var eventFieldBuilder = typeBuilder.GetEventBrokerFielTypeDefinition(@event);

            methodSignatureWeaver = new RaiseEventMethodSignatureWeaver(eventTypeBuilder, typeBuilder, eventFieldBuilder);
        }
コード例 #18
0
 internal AbstractPropertyBindingWeaver(PropertyInfo property, BindingSettings bindingSettings, IAspectWeavingSettings aspectWeavingSettings, IMethodScopeWeaver getMethodScopeWeaver = null, IMethodScopeWeaver setMethodScopeWeaver = null)
 {
     this.property = property;
     this.bindingSettings = bindingSettings;
     this.getMethodScopeWeaver = getMethodScopeWeaver;
     this.setMethodScopeWeaver = setMethodScopeWeaver;
     this.aspectWeavingSettings = aspectWeavingSettings;
 }
コード例 #19
0
        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);
        }
コード例 #20
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);
 }
コード例 #21
0
        public override IAspectWeaver Reduce(IAspectWeavingSettings aspectWeavingSettings)
        {
            var bindingWeaver = propertyBuilder.Build(aspectWeavingSettings);
            var clonedSettings = aspectWeavingSettings.CloneWith(settings => {
                settings.LocalBuilderRepository = new LocalBuilderRepository();
            });

            return CreateWeaver(clonedSettings, bindingWeaver.WeavedType);
        }
コード例 #22
0
 internal AdviceWeavingSettings(IAspectWeavingSettings aspectWeavingSettings, IArgumentsWeavingSettings argumentsWeavingSettings)
 {
     AspectType = argumentsWeavingSettings.AspectType;
     ArgumentsWeavingSettings = argumentsWeavingSettings;
     WeavingSettings          = aspectWeavingSettings.WeavingSettings;
     AspectRepository         = aspectWeavingSettings.AspectRepository;
     AspectArgsMapper         = aspectWeavingSettings.AspectArgsMapper;
     LocalBuilderRepository   = aspectWeavingSettings.LocalBuilderRepository;
 }
コード例 #23
0
 internal AdviceWeavingSettings(IAspectWeavingSettings aspectWeavingSettings, IArgumentsWeavingSettings argumentsWeavingSettings)
 {
     AspectType = argumentsWeavingSettings.AspectType;
     ArgumentsWeavingSettings = argumentsWeavingSettings;
     WeavingSettings = aspectWeavingSettings.WeavingSettings;
     AspectRepository = aspectWeavingSettings.AspectRepository;
     AspectArgsMapper = aspectWeavingSettings.AspectArgsMapper;
     LocalBuilderRepository = aspectWeavingSettings.LocalBuilderRepository;
 }
        public override IAspectWeaver Reduce(IAspectWeavingSettings aspectWeavingSettings)
        {
            var bindingWeaver  = propertyBuilder.Build(aspectWeavingSettings);
            var clonedSettings = aspectWeavingSettings.CloneWith(settings => {
                settings.LocalBuilderRepository = new LocalBuilderRepository();
            });

            return(CreateWeaver(clonedSettings, bindingWeaver.WeavedType));
        }
コード例 #25
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);
        }
コード例 #26
0
 internal IsolatedEventInterceptionBindingWeaver(IAspectExpression addAspectExpression, IAspectExpression removeAspectExpression, IAspectExpression invokeAspectExpression, IEventAspectDefinition aspectDefinition, IAspectWeavingSettings aspectWeavingSettings)
     : base(aspectDefinition)
 {
     this.addAspectExpression    = addAspectExpression;
     this.aspectWeavingSettings  = aspectWeavingSettings;
     this.removeAspectExpression = removeAspectExpression;
     this.invokeAspectExpression = invokeAspectExpression;
     lazyWeavedType = new Core.Lib.Lazy <FieldInfo>(WeaveType);
 }
コード例 #27
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);
 }
コード例 #28
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);
 }
コード例 #29
0
        public override IAspectWeaver Reduce(IAspectWeavingSettings aspectWeavingSettings)
        {
            var clonedAspectWeavingSettings = aspectWeavingSettings.CloneWith(settings => {
                settings.LocalBuilderRepository = new LocalBuilderRepository();
            });

            var bindingWeaver = new IsolatedGetPropertyInterceptionBindingWeaver(aspectExpression, aspectDefinition, clonedAspectWeavingSettings);

            return(new TopGetPropertyInterceptionAspectWeaver(aspectDefinition, clonedAspectWeavingSettings, bindingWeaver.WeavedType));
        }
コード例 #30
0
 public EventInterceptionBindingWeaver(EventInfo @event, BindingSettings bindingSettings, IAspectWeavingSettings aspectWeavingSettings, IAspectWeaver addMethodScopeWeaver, IAspectWeaver removeMethodScopeWeaver, IAspectWeaver invokeMethodScopeWeaver)
 {
     this.@event                  = @event;
     this.bindingSettings         = bindingSettings;
     this.addMethodScopeWeaver    = addMethodScopeWeaver;
     this.aspectWeavingSettings   = aspectWeavingSettings;
     this.removeMethodScopeWeaver = removeMethodScopeWeaver;
     this.invokeMethodScopeWeaver = invokeMethodScopeWeaver;
     ResolveParameterTypes();
 }
コード例 #31
0
 internal AbstractMethodAspectWeaver(IAspectDefinition aspectDefinition, IAspectWeavingSettings aspectWevingSettings)
 {
     advices = aspectDefinition.Advices;
     this.aspectDefinition      = aspectDefinition;
     this.aspectWeavingSettings = aspectWevingSettings;
     weavingSettings            = aspectWevingSettings.WeavingSettings;
     aspectRepository           = aspectWevingSettings.AspectRepository;
     argumentsWeavingSetings    = aspectDefinition.ToArgumentsWeavingSettings();
     aspectDefinition.Advices.ForEach(advice => advice.Accept(adviceDiscoveryVistor));
 }
コード例 #32
0
        protected AbstractAspectMethodWeaver(MethodInfo method, IAspectDefinitionCollection aspectDefinitions, IAspectWeavingSettings aspectWeavingSettings)
        {
            IAspectExpression aspectExpression = null;
            var aspectExpressionBuilder = new AspectExpressionTreeBuilder(aspectDefinitions);

            this.method = method;
            methodEndWeaver = new MethodEndWeaver();
            aspectExpression = aspectExpressionBuilder.Build();
            methodScopeWeaver = aspectExpression.Reduce(aspectWeavingSettings);
        }
コード例 #33
0
        public override IAspectWeaver Reduce(IAspectWeavingSettings aspectWeavingSettings)
        {
            var clonedSettings = aspectWeavingSettings.CloneWith(settings => {
                settings.ByRefArgumentsStoreWeaver = NullObjectByRefArgumentsStoreWeaver.Empty;
            });

            var nestedWeaver = aspectExpression.Reduce(clonedSettings);

            return(new BindingOnMethodBoundaryAspectWeaver(nestedWeaver, aspectDefinition, clonedSettings));
        }
コード例 #34
0
        public override IAspectWeaver Reduce(IAspectWeavingSettings aspectWeavingSettings)
        {
            var clonedAspectWeavingSettings = aspectWeavingSettings.CloneWith(settings => {
                settings.LocalBuilderRepository = new LocalBuilderRepository();
            });

            var bindingWeaver = new IsolatedSetPropertyInterceptionBindingWeaver(aspectExpression, aspectDefinition, clonedAspectWeavingSettings);

            return new BindingSetPropertyInterceptionAspectWeaver(aspectDefinition, aspectWeavingSettings, bindingWeaver.WeavedType);
        }
コード例 #35
0
 public EventInterceptionBindingWeaver(EventInfo @event, BindingSettings bindingSettings, IAspectWeavingSettings aspectWeavingSettings, IAspectWeaver addMethodScopeWeaver, IAspectWeaver removeMethodScopeWeaver, IAspectWeaver invokeMethodScopeWeaver)
 {
     this.@event = @event;
     this.bindingSettings = bindingSettings;
     this.addMethodScopeWeaver = addMethodScopeWeaver;
     this.aspectWeavingSettings = aspectWeavingSettings;
     this.removeMethodScopeWeaver = removeMethodScopeWeaver;
     this.invokeMethodScopeWeaver = invokeMethodScopeWeaver;
     ResolveParameterTypes();
 }
コード例 #36
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);
 }
コード例 #37
0
 internal AbstractAspectWeaver(IAspectDefinition aspectDefinition, IAspectWeavingSettings aspectWeavingSettings)
 {
     advices = aspectDefinition.Advices;
     this.aspectDefinition = aspectDefinition;
     this.aspectWeavingSettings = aspectWeavingSettings;
     bindingSettings = aspectDefinition.ToBindingSettings();
     weavingSettings = aspectWeavingSettings.WeavingSettings;
     aspectRepository = aspectWeavingSettings.AspectRepository;
     argumentsWeavingSettings = aspectDefinition.ToArgumentsWeavingSettings();
     aspectDefinition.Advices.ForEach(advice => advice.Accept(adviceDiscoveryVistor));
 }
コード例 #38
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);
        }
コード例 #39
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);
        }
コード例 #40
0
        public override IAspectWeaver Reduce(IAspectWeavingSettings aspectWeavingSettings)
        {
            var topBindingArgType = aspectDefinition.ToAspectArgumentImpl();
            var clonedSettings = aspectWeavingSettings.CloneWith(settings => {
                settings.ByRefArgumentsStoreWeaver = new BindingByRefArgumentsWeaverImpl(topBindingArgType, aspectDefinition.Member, settings.LocalBuilderRepository);
            });

            var nestedWeaver = aspectExpression.Reduce(clonedSettings);

            return new TopBindingOnMethodBoundaryAspectWeaver(nestedWeaver, aspectDefinition, clonedSettings);
        }
コード例 #41
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 });
        }
コード例 #42
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);
        }
コード例 #43
0
        public override IAspectWeaver Reduce(IAspectWeavingSettings aspectWeavingSettings)
        {
            var topBindingArgType = aspectDefinition.ToAspectArgumentImpl();
            var clonedSettings    = aspectWeavingSettings.CloneWith(settings => {
                settings.ByRefArgumentsStoreWeaver = new BindingByRefArgumentsWeaverImpl(topBindingArgType, aspectDefinition.Member, settings.LocalBuilderRepository);
            });

            var nestedWeaver = aspectExpression.Reduce(clonedSettings);

            return(new TopBindingOnMethodBoundaryAspectWeaver(nestedWeaver, aspectDefinition, clonedSettings));
        }
コード例 #44
0
        public override IAspectWeaver Reduce(IAspectWeavingSettings aspectWeavingSettings)
        {
            var topAspectInScopeArgType = topAspectInScopeDefinition.ToAspectArgumentImpl();

            var clonedSettings = aspectWeavingSettings.CloneWith(settings => {
                settings.ByRefArgumentsStoreWeaver = NullObjectByRefArgumentsStoreWeaver.Empty;
            });

            var nestedWeaver = aspectExpression.Reduce(clonedSettings);

            return new BindingOnMethodBoundaryAspectWeaver(topAspectInScopeArgType, nestedWeaver, aspectDefinition, clonedSettings);
        }
コード例 #45
0
ファイル: AspectsWeaver.cs プロジェクト: arieldeil/NCop
        public AspectsWeaver(IAspectExpression aspectExpression, IAspectDefinitionCollection aspectDefinitions, IWeavingSettings weavingSettings)
        {
            this.aspectExpression  = aspectExpression;
            aspectArgsMapperWeaver = new AspectArgsMapperWeaver();
            aspectAttributeWeaver  = new AspectsAttributeWeaver(aspectDefinitions);

            settings = new AspectWeavingSettingsImpl {
                WeavingSettings  = weavingSettings,
                AspectRepository = aspectAttributeWeaver,
                AspectArgsMapper = aspectArgsMapperWeaver
            };
        }
コード例 #46
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);
        }
コード例 #47
0
        internal AbstractAspectArgsMappingWeaver(IAspectWeavingSettings aspectWeavingSettings, IArgumentsSettings argumentsSettings)
        {
            Type[] @params = null;

            this.argumentsSettings = argumentsSettings;
            this.aspectWeavingSettings = aspectWeavingSettings;
            aspectArgumentType = argumentsSettings.ArgumentType;
            weavingSettings = aspectWeavingSettings.WeavingSettings;
            localBuilderRepository = aspectWeavingSettings.LocalBuilderRepository;
            @params = argumentsSettings.ArgumentType.GetGenericArguments();
            parameters = argumentsSettings.Parameters;
            mappingParameters = @params.Skip(1).ToArray();
        }
コード例 #48
0
        internal BindingRaiseEventInterceptionAspectWeaver(IEventAspectDefinition aspectDefinition, IAspectWeavingSettings aspectWeavingSettings, FieldInfo weavedType)
            : base(aspectDefinition, aspectWeavingSettings, weavedType)
        {
            argumentsWeavingSettings.BindingsDependency = weavedType;
            argumentsWeavingSettings.Parameters = new[] { aspectDefinition.Member.EventHandlerType };
            argumentsWeaver = new BindingEventInterceptionArgumentsWeaver(aspectDefinition, argumentsWeavingSettings, aspectWeavingSettings, bindingSettings);

            if (aspectDefinition.Member.IsFunction()) {
                methodScopeWeavers.Add(new TopGetReturnValueWeaver(aspectWeavingSettings, argumentsWeavingSettings));
            }

            weaver = new MethodScopeWeaversQueue(methodScopeWeavers);
        }
コード例 #49
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;
 }
コード例 #50
0
        internal AbstractAspectArgsMappingWeaver(IAspectWeavingSettings aspectWeavingSettings, IArgumentsSettings argumentsSettings)
        {
            Type[] @params = null;

            this.argumentsSettings     = argumentsSettings;
            this.aspectWeavingSettings = aspectWeavingSettings;
            aspectArgumentType         = argumentsSettings.ArgumentType;
            weavingSettings            = aspectWeavingSettings.WeavingSettings;
            localBuilderRepository     = aspectWeavingSettings.LocalBuilderRepository;
            @params           = argumentsSettings.ArgumentType.GetGenericArguments();
            parameters        = argumentsSettings.Parameters;
            mappingParameters = @params.Skip(1).ToArray();
        }
コード例 #51
0
        public override IAspectWeaver Reduce(IAspectWeavingSettings aspectWeavingSettings)
        {
            var clonedAspectWeavingSettings = aspectWeavingSettings.CloneWith(settings => {
                var localBuilderRepository = new LocalBuilderRepository();
                var aspectArgumentImplType = aspectDefinition.ToAspectArgumentImpl();

                settings.LocalBuilderRepository    = localBuilderRepository;
                settings.ByRefArgumentsStoreWeaver = new TopAspectByRefArgumentsStoreWeaver(aspectArgumentImplType, aspectDefinition.Member, localBuilderRepository);
            });

            var bindingWeaver = new IsolatedMethodInterceptionBindingWeaver(aspectExpression, aspectDefinition, clonedAspectWeavingSettings);

            return(new TopMethodInterceptionAspectWeaver(aspectDefinition, clonedAspectWeavingSettings, bindingWeaver.WeavedType));
        }
コード例 #52
0
        public override IAspectWeaver Reduce(IAspectWeavingSettings aspectWeavingSettings)
        {
            var clonedAspectWeavingSettings = aspectWeavingSettings.CloneWith(settings => {
                var localBuilderRepository = new LocalBuilderRepository();
                var aspectArgumentImplType = aspectDefinition.ToAspectArgumentImpl();

                settings.LocalBuilderRepository    = localBuilderRepository;
                settings.ByRefArgumentsStoreWeaver = new TopAspectByRefArgumentsStoreWeaver(aspectArgumentImplType, aspectDefinition.Member, localBuilderRepository);
            });

            var nestedWeaver = aspectExpression.Reduce(clonedAspectWeavingSettings);

            return(new TopOnMethodBoundaryAspectWeaver(nestedWeaver, aspectDefinition, clonedAspectWeavingSettings));
        }
コード例 #53
0
ファイル: AspectExtensions.cs プロジェクト: arieldeil/NCop
        internal static AspectWeavingSettingsImpl CloneWith(this IAspectWeavingSettings aspectWeavingSettings, Action <AspectWeavingSettingsImpl> cloneFunc)
        {
            var clonedAspectWeavingSettings = new AspectWeavingSettingsImpl {
                WeavingSettings           = aspectWeavingSettings.WeavingSettings,
                AspectRepository          = aspectWeavingSettings.AspectRepository,
                AspectArgsMapper          = aspectWeavingSettings.AspectArgsMapper,
                LocalBuilderRepository    = aspectWeavingSettings.LocalBuilderRepository,
                ByRefArgumentsStoreWeaver = aspectWeavingSettings.ByRefArgumentsStoreWeaver
            };

            cloneFunc(clonedAspectWeavingSettings);

            return(clonedAspectWeavingSettings);
        }
コード例 #54
0
        public override IAspectWeaver Reduce(IAspectWeavingSettings aspectWeavingSettings)
        {
            var clonedAspectWeavingSettings = aspectWeavingSettings.CloneWith(settings => {
                var localBuilderRepository = new LocalBuilderRepository();
                var aspectArgumentImplType = aspectDefinition.ToAspectArgumentImpl();

                settings.LocalBuilderRepository = localBuilderRepository;
                settings.ByRefArgumentsStoreWeaver = new TopAspectByRefArgumentsStoreWeaver(aspectArgumentImplType, aspectDefinition.Member, localBuilderRepository);
            });

            var bindingWeaver = new IsolatedMethodInterceptionBindingWeaver(aspectExpression, aspectDefinition, clonedAspectWeavingSettings);

            return new TopMethodInterceptionAspectWeaver(aspectDefinition, clonedAspectWeavingSettings, bindingWeaver.WeavedType);
        }
コード例 #55
0
        public override IAspectWeaver Reduce(IAspectWeavingSettings aspectWeavingSettings)
        {
            var clonedAspectWeavingSettings = aspectWeavingSettings.CloneWith(settings => {
                var localBuilderRepository = new LocalBuilderRepository();
                var aspectArgumentImplType = aspectDefinition.ToAspectArgumentImpl();

                settings.LocalBuilderRepository = localBuilderRepository;
                settings.ByRefArgumentsStoreWeaver = new TopAspectByRefArgumentsStoreWeaver(aspectArgumentImplType, aspectDefinition.Member, localBuilderRepository);
            });

            var nestedWeaver = aspectExpression.Reduce(clonedAspectWeavingSettings);

            return new TopOnMethodBoundaryAspectWeaver(nestedWeaver, aspectDefinition, clonedAspectWeavingSettings);
        }
コード例 #56
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;
 }
コード例 #57
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);
 }
コード例 #58
0
 public IBindingTypeReflector Build(IAspectWeavingSettings aspectsWeavingSettings)
 {
     return(lazyBindingTypeReflector.Get(addAspectExpression, removeAspectExpression, invokeAspectExpression, aspectsWeavingSettings));
 }
コード例 #59
0
 internal AbstractTopPropertyAspectArgumentsWeaver(PropertyInfo property, IArgumentsWeavingSettings argumentWeavingSettings, IAspectWeavingSettings aspectWeavingSettings)
     : base(property, argumentWeavingSettings, aspectWeavingSettings)
 {
     IsProperty         = true;
     bindingsDependency = argumentWeavingSettings.BindingsDependency;
 }
コード例 #60
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);
        }