示例#1
0
        internal static RequestCreContext Create(InterfaceWrapContext interfaceWrap, MethodWrapContext methodWrap, WrapBase wrapinstance)
        {
            RequestCreContext instance = new RequestCreContext(interfaceWrap, methodWrap, wrapinstance);

            instance.CreateHeaderBind();
            return(instance);
        }
示例#2
0
        internal static MethodWrapContext GetContext(InterfaceWrapContext interfaceWrapContext, MethodInfo methodInfo)
        {
            MethodWrapContext methodWrapContext = new MethodWrapContext();

            methodWrapContext.interfaceType        = interfaceWrapContext.InterfaceType;
            methodWrapContext.methodInfo           = methodInfo;
            methodWrapContext.interfaceWrapContext = interfaceWrapContext;
            methodWrapContext.ReturnContext        = ReturnContext.CreContext(methodInfo.ReturnParameter);


            object[]      cas = methodInfo.GetCustomAttributes(true);
            BaseAttribute LarkAttribute;

            object        ca;
            List <string> headers = new List <string>();

            for (int i = 0; i < cas.Length; i++)
            {
                ca = cas[i];
                if (false == typeof(BaseAttribute).IsInstanceOfType(ca))
                {
                    continue;
                }
                LarkAttribute = ca as BaseAttribute;
                LarkAttribute.SaveToMethodContext(methodWrapContext);
            }

            methodWrapContext.CreateBind();

            methodWrapContext.SaveParameter();

            methodWrapContext.Validate();

            return(methodWrapContext);
        }
示例#3
0
        internal static ParameterWrapContext GetContext(MethodWrapContext methodWrapContext, ParameterInfo parameterInfo)
        {
            MethodInfo methodInfo = methodWrapContext.methodInfo;

            Attribute            attribute;
            ParameterWrapContext parameterContext;
            BaseAttribute        LarkAttribute;



            parameterContext = new ParameterWrapContext(methodWrapContext, parameterInfo);
            IEnumerable <Attribute> attributes = parameterInfo.GetCustomAttributes();
            IEnumerator <Attribute> enumerator = attributes.GetEnumerator();

            while (enumerator.MoveNext())
            {
                attribute = enumerator.Current;
                if (false == typeof(BaseAttribute).IsInstanceOfType(attribute))
                {
                    continue;
                }
                LarkAttribute = attribute as BaseAttribute;

                LarkAttribute.SaveToParameterContext(parameterContext);
            }

            parameterContext.BindAttribute();
            return(parameterContext);
        }
示例#4
0
        internal void SaveMethod()
        {
            MethodWrapContext methodWrapContext;

            MethodInfo[] interfacemethods = InterfaceType.GetMethods();
            MethodInfo   interfacemethodInfo;
            MethodItem   methodItem;

            for (int i = 0; i < interfacemethods.Length; i++)
            {
                interfacemethodInfo = interfacemethods[i];
                methodWrapContext   = MethodWrapContext.GetContext(this, interfacemethodInfo);
                methodItem          = new MethodItem(interfacemethodInfo, methodWrapContext);
                MethodCache[interfacemethodInfo] = methodItem;
            }
        }
示例#5
0
 private RequestCreContext(InterfaceWrapContext interfaceWrap, MethodWrapContext methodWrap, WrapBase wrapinstance)
 {
     this.InfaceContext = interfaceWrap;
     this.MethodWrap    = methodWrap;
     this.WrapInstance  = wrapinstance;
 }
示例#6
0
 public ParameterWrapContext(MethodWrapContext methodWrapContext, ParameterInfo parameter) : this()
 {
     this.Parameter  = parameter;
     this.MethodWrap = methodWrapContext;
 }