Ejemplo n.º 1
0
        internal static Type ToAspectArgumentImpl(this IAspectDefinition aspectDefinition)
        {
            var argumentType = aspectDefinition.GetArgumentType();
            var declaringType = aspectDefinition.Member.DeclaringType;
            var genericArguments = argumentType.GetGenericArguments();
            var genericArgumentsWithContext = new[] { declaringType }.Concat(genericArguments);

            return(argumentType.MakeGenericArgsType(genericArgumentsWithContext.ToArray()));
        }
Ejemplo n.º 2
0
        private static Type ToAspectArgumentImpl(this IAspectDefinition aspectDefinition, MethodInfo method)
        {
            var declaringType = method.DeclaringType;
            var argumentType = aspectDefinition.GetArgumentType();
            var genericArguments = argumentType.GetGenericArguments();
            var genericArgumentsWithContext = new[] { declaringType }.Concat(genericArguments);

            return(argumentType.MakeGenericArgsType(method, genericArgumentsWithContext.ToArray()));
        }
Ejemplo n.º 3
0
        internal static BindingSettings ToBindingSettings(this IAspectDefinition aspectDefinition)
        {
            var aspectArgumentType     = aspectDefinition.GetArgumentType();
            var aspectArgumentImplType = aspectDefinition.ToAspectArgumentImpl();
            var genericArguments       = aspectArgumentImplType.GetGenericArguments();

            if (aspectArgumentType.IsFunctionAspectArgs())
            {
                return(new BindingSettings {
                    IsFunction = true,
                    ArgumentType = aspectArgumentImplType,
                    BindingType = aspectArgumentType.MakeGenericFunctionBinding(genericArguments)
                });
            }

            return(new BindingSettings {
                IsFunction = false,
                ArgumentType = aspectArgumentImplType,
                BindingType = aspectArgumentType.MakeGenericActionBinding(genericArguments)
            });
        }