Beispiel #1
0
 public AspectMap(MemberInfo target, MemberInfo contract, MethodInfo method, IAspectDefinitionCollection aspects)
 {
     Method   = method;
     Target   = target;
     Aspects  = aspects;
     Contract = contract;
 }
Beispiel #2
0
 public AspectMap(MemberInfo target, MemberInfo contract, MethodInfo method, IAspectDefinitionCollection aspects)
 {
     Method = method;
     Target = target;
     Aspects = aspects;
     Contract = contract;
 }
Beispiel #3
0
 internal CompositeMethodWeaver(IAspectDefinitionCollection aspectDefinition, IWeavingSettings weavingSettings)
     : base(weavingSettings)
 {
     methodWeaver          = new AspectMethodWeaver(aspectDefinition, weavingSettings);
     MethodDefintionWeaver = methodWeaver.MethodDefintionWeaver;
     MethodScopeWeaver     = methodWeaver.MethodScopeWeaver;
     MethodEndWeaver       = methodWeaver.MethodEndWeaver;
 }
        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);
        }
Beispiel #5
0
        public AspectMethodWeaver(IAspectDefinitionCollection aspectDefinitions, IWeavingSettings weavingSettings)
            : base(weavingSettings)
        {
            var aspectExpression = new AspectExpressionTreeBuilder(aspectDefinitions, weavingSettings).Build();

            MethodEndWeaver       = new MethodEndWeaver();
            MethodScopeWeaver     = aspectExpression.Reduce(AspectWeavingSettingsImpl.Empty);
            MethodDefintionWeaver = new MethodSignatureWeaver(weavingSettings.TypeDefinition);
        }
Beispiel #6
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);
        }
        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);
        }
Beispiel #8
0
        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
            };
        }
Beispiel #9
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);
        }
Beispiel #10
0
 internal CompositeMethodWeaver(MethodInfo method, IAspectDefinitionCollection aspectDefinitions, IAspectWeavingSettings aspectWeavingSettings)
     : base(method, aspectDefinitions, aspectWeavingSettings)
 {
 }
Beispiel #11
0
 internal AspectExpression(IAspectExpression aspectExpression, IAspectDefinitionCollection aspectsDefinitions, IWeavingSettings weavingSettings)
 {
     this.weavingSettings    = weavingSettings;
     this.aspectExpression   = aspectExpression;
     this.aspectsDefinitions = aspectsDefinitions;
 }
 public AspectPropertyWeaver(MethodInfo method, IAspectDefinitionCollection aspectDefinitions, IAspectWeavingSettings aspectWeavingSettings)
     : base(method, aspectDefinitions, aspectWeavingSettings)
 {
 }
Beispiel #13
0
 public AspectEventWeaver(IEventTypeBuilder eventTypeBuilder, MethodInfo method, IAspectDefinitionCollection aspectDefinitions, IAspectWeavingSettings aspectWeavingSettings)
     : base(method, aspectDefinitions, aspectWeavingSettings)
 {
     this.eventTypeBuilder = eventTypeBuilder;
 }
Beispiel #14
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);
        }
Beispiel #15
0
 public GetPropertyAspectWeaver(IPropertyTypeBuilder propertyTypeBuilder, MethodInfo method, IAspectDefinitionCollection aspectDefinitions, IAspectWeavingSettings aspectWeavingSettings)
     : base(method, aspectDefinitions, aspectWeavingSettings)
 {
     methodSignatureWeaver = new GetPropertyMethodSignatureWeaver(propertyTypeBuilder, aspectWeavingSettings.WeavingSettings.TypeDefinition);
 }
 internal AbstractCompositeMap(Type contractType, Type implementationType, TMember contractMember, TMember implementationMember, IAspectDefinitionCollection aspectDefinitions)
     : base(contractType, implementationType, contractMember, implementationMember)
 {
     AspectDefinitions    = aspectDefinitions;
     HasAspectDefinitions = aspectDefinitions.IsNotNullOrEmpty();
 }
Beispiel #17
0
 internal AbstractCompositeFragmentEventMap(Type contractType, Type implementationType, EventInfo contractEvent, EventInfo implementationEvent, IAspectDefinitionCollection aspectDefinitions)
     : base(contractType, implementationType, contractEvent, implementationEvent, aspectDefinitions)
 {
 }
Beispiel #18
0
 public AspectPropertyWeaver(MethodInfo method, IAspectDefinitionCollection aspectDefinitions, IAspectWeavingSettings aspectWeavingSettings)
     : base(method, aspectDefinitions, aspectWeavingSettings)
 {
 }
Beispiel #19
0
 public CompositePropertyMap(Type contractType, Type implementationType, PropertyInfo contractProperty, PropertyInfo implementationProperty, IAspectDefinitionCollection aspectDefinitions)
     : base(contractType, implementationType, contractProperty, implementationProperty)
 {
     AspectDefinitions    = aspectDefinitions;
     HasAspectDefinitions = aspectDefinitions.IsNotNullOrEmpty();
 }
Beispiel #20
0
 internal AbstractCompositeFragmentPropertyMap(Type contractType, Type implementationType, PropertyInfo contractProperty, PropertyInfo implementationProperty, IAspectDefinitionCollection aspectDefinitions)
     : base(contractType, implementationType, contractProperty, implementationProperty, aspectDefinitions)
 {
 }
Beispiel #21
0
 public AspectsAttributeWeaver(IAspectDefinitionCollection aspectDefinitions)
 {
     this.aspectDefinitions = aspectDefinitions;
 }
Beispiel #22
0
 public AspectEventWeaver(IEventTypeBuilder eventTypeBuilder, MethodInfo method, IAspectDefinitionCollection aspectDefinitions, IAspectWeavingSettings aspectWeavingSettings)
     : base(method, aspectDefinitions, aspectWeavingSettings)
 {
     this.eventTypeBuilder = eventTypeBuilder;
 }
 public CompositeRaiseEventMap(Type contractType, Type implementationType, EventInfo contractEvent, EventInfo implementationEvent, IAspectDefinitionCollection aspectDefinitions)
     : base(contractType, implementationType, contractEvent, implementationEvent, aspectDefinitions)
 {
     FragmentMethod = contractEvent.GetInvokeMethod();
 }
Beispiel #24
0
 public CompositeSetPropertyWeaver(IPropertyTypeBuilder propertyTypeBuilder, PropertyInfo property, IAspectDefinitionCollection aspectDefinitions, IAspectWeavingSettings aspectWeavingSettings)
     : base(property.GetSetMethod(), aspectDefinitions, aspectWeavingSettings)
 {
     methodSignatureWeaver = new SetPropertyMethodSignatureWeaver(propertyTypeBuilder, aspectWeavingSettings.WeavingSettings.TypeDefinition);
 }
 public CompositeRaiseEventMap(Type contractType, Type implementationType, EventInfo contractEvent, EventInfo implementationEvent, IAspectDefinitionCollection aspectDefinitions)
     : base(contractType, implementationType, contractEvent, implementationEvent, aspectDefinitions)
 {
     FragmentMethod = contractEvent.GetInvokeMethod();
 }
 internal CompositeMethodWeaver(MethodInfo method, IAspectDefinitionCollection aspectDefinitions, IAspectWeavingSettings aspectWeavingSettings)
     : base(method, aspectDefinitions, aspectWeavingSettings)
 {
 }
 public CompositeMethodMap(Type contractType, Type implementationType, MethodInfo contractMethod, MethodInfo implementationMethod, IAspectDefinitionCollection aspectDefinitions)
     : base(contractType, implementationType, contractMethod, implementationMethod)
 {
     AspectDefinitions    = aspectDefinitions;
     HasAspectDefinitions = aspectDefinitions.IsNotNullOrEmpty();
 }
 internal CompositeAddEventWeaver(IEventTypeBuilder eventTypeBuilder, MethodInfo method, IAspectDefinitionCollection aspectDefinitions, IAspectWeavingSettings aspectWeavingSettings)
     : base(eventTypeBuilder, method, aspectDefinitions, aspectWeavingSettings)
 {
     methodSignatureWeaver = new AddEventMethodSignatureWeaver(eventTypeBuilder, aspectWeavingSettings.WeavingSettings.TypeDefinition);
 }
 public CompositeGetPropertyWeaver(IPropertyTypeBuilder propertyTypeBuilder, PropertyInfo property, IAspectDefinitionCollection aspectDefinitions, IAspectWeavingSettings aspectWeavingSettings)
     : base(property.GetGetMethod(), aspectDefinitions, aspectWeavingSettings)
 {
     methodSignatureWeaver = new GetPropertyMethodSignatureWeaver(propertyTypeBuilder, aspectWeavingSettings.WeavingSettings.TypeDefinition);
 }
 internal CompositeGetPropertyMap(Type contractType, Type implementationType, PropertyInfo contractProperty, PropertyInfo implementationProperty, IAspectDefinitionCollection aspectDefinitions)
     : base(contractType, implementationType, contractProperty, implementationProperty, aspectDefinitions)
 {
     FragmentMethod = contractProperty.GetGetMethod();
 }
 internal CompositeGetPropertyMap(Type contractType, Type implementationType, PropertyInfo contractProperty, PropertyInfo implementationProperty, IAspectDefinitionCollection aspectDefinitions)
     : base(contractType, implementationType, contractProperty, implementationProperty, aspectDefinitions)
 {
     FragmentMethod = contractProperty.GetGetMethod();
 }
 public GetPropertyAspectWeaver(IPropertyTypeBuilder propertyTypeBuilder, MethodInfo method, IAspectDefinitionCollection aspectDefinitions, IAspectWeavingSettings aspectWeavingSettings)
     : base(method, aspectDefinitions, aspectWeavingSettings)
 {
     methodSignatureWeaver = new GetPropertyMethodSignatureWeaver(propertyTypeBuilder, aspectWeavingSettings.WeavingSettings.TypeDefinition);
 }
Beispiel #33
0
 public AspectMap(MemberInfo member, IAspectDefinitionCollection aspects)
 {
     Member  = member;
     Aspects = aspects;
 }
Beispiel #34
0
 protected AspectMethodWeaver(MethodInfo method, IAspectDefinitionCollection aspectDefinitions, IAspectWeavingSettings aspectWeavingSettings)
     : base(method, aspectDefinitions, aspectWeavingSettings)
 {
     methodSignatureWeaver = new MethodSignatureWeaver(aspectWeavingSettings.WeavingSettings.TypeDefinition);
 }
Beispiel #35
0
 internal CompositeRemoveEventWeaver(IEventTypeBuilder eventTypeBuilder, MethodInfo method, IAspectDefinitionCollection aspectDefinitions, IAspectWeavingSettings aspectWeavingSettings)
     : base(eventTypeBuilder, method, aspectDefinitions, aspectWeavingSettings)
 {
     methodSignatureWeaver = new RemoveEventMethodSignatureWeaver(eventTypeBuilder, aspectWeavingSettings.WeavingSettings.TypeDefinition);
 }
Beispiel #36
0
 protected AspectMethodWeaver(MethodInfo method, IAspectDefinitionCollection aspectDefinitions, IAspectWeavingSettings aspectWeavingSettings)
     : base(method, aspectDefinitions, aspectWeavingSettings)
 {
     methodSignatureWeaver = new MethodSignatureWeaver(aspectWeavingSettings.WeavingSettings.TypeDefinition);
 }