コード例 #1
0
        public void EmitAddQueryProperty(EmittedProperty property, QuerySerializationMethod serializationMethod)
        {
            Assert(property.PropertyModel.QueryAttribute != null);
            var attribute = property.PropertyModel.QueryAttribute.Attribute;

            this.writer.WriteLine(this.requestInfoLocalName + ".AddQueryProperty(" + EnumValue(serializationMethod) + ", " +
                                  QuoteString(property.PropertyModel.QueryAttributeName) + ", " + ReferenceTo(property.PropertyModel) + ", " +
                                  QuoteString(attribute.Format) + ");");
        }
コード例 #2
0
        public void EmitAddPathProperty(EmittedProperty property, PathSerializationMethod serializationMethod)
        {
            Assert(property.PropertyModel.PathAttribute != null);
            var attribute = property.PropertyModel.PathAttribute.Attribute;

            this.writer.WriteLine(this.requestInfoLocalName + ".AddPathProperty(" + EnumValue(serializationMethod) + ", " +
                                  QuoteString(property.PropertyModel.PathAttributeName) + ", " + ReferenceTo(property.PropertyModel) + ", " +
                                  QuoteString(attribute.Format) + ", " + (attribute.UrlEncode ? "true" : "false") + ");");
        }
コード例 #3
0
        public void EmitAddHeaderProperty(EmittedProperty property)
        {
            Assert(property.PropertyModel.HeaderAttribute != null);
            var attribute = property.PropertyModel.HeaderAttribute.Attribute;

            this.writer.WriteLine(this.requestInfoLocalName + ".AddPropertyHeader(" + QuoteString(attribute.Name) + ", " +
                                  ReferenceTo(property.PropertyModel) + ", " + QuoteString(attribute.Value) + ", " +
                                  QuoteString(attribute.Format) + ");");
        }
コード例 #4
0
 public void EmitAddHttpRequestMessagePropertyProperty(EmittedProperty property)
 {
     this.ilGenerator.Emit(OpCodes.Ldloc, this.requestInfoLocal);
     this.ilGenerator.Emit(OpCodes.Ldstr, property.PropertyModel.HttpRequestMessagePropertyAttributeKey);
     this.ilGenerator.Emit(OpCodes.Ldarg_0);
     this.ilGenerator.Emit(OpCodes.Ldfld, property.FieldBuilder);
     if (property.FieldBuilder.FieldType.GetTypeInfo().IsValueType)
     {
         this.ilGenerator.Emit(OpCodes.Box, property.FieldBuilder.FieldType);
     }
     this.ilGenerator.Emit(OpCodes.Callvirt, MethodInfos.RequestInfo_AddRequestPropertyProperty);
 }
コード例 #5
0
        public void EmitAddQueryProperty(EmittedProperty property, QuerySerializationMethod serializationMethod)
        {
            Assert(property.PropertyModel.QueryAttribute != null);
            var attribute   = property.PropertyModel.QueryAttribute.Attribute;
            var typedMethod = MethodInfos.RequestInfo_AddQueryProperty.MakeGenericMethod(property.FieldBuilder.FieldType);

            this.ilGenerator.Emit(OpCodes.Ldloc, this.requestInfoLocal);
            this.ilGenerator.Emit(OpCodes.Ldc_I4, (int)serializationMethod);
            this.ilGenerator.Emit(OpCodes.Ldstr, property.PropertyModel.QueryAttributeName);
            this.ilGenerator.Emit(OpCodes.Ldarg_0);
            this.ilGenerator.Emit(OpCodes.Ldfld, property.FieldBuilder);
            this.LoadString(attribute.Format);
            this.ilGenerator.Emit(OpCodes.Callvirt, typedMethod);
        }
コード例 #6
0
        public void EmitAddHeaderProperty(EmittedProperty property)
        {
            Assert(property.PropertyModel.HeaderAttribute != null);
            var attribute   = property.PropertyModel.HeaderAttribute.Attribute;
            var typedMethod = MethodInfos.RequestInfo_AddPropertyHheader.MakeGenericMethod(property.FieldBuilder.FieldType);

            this.ilGenerator.Emit(OpCodes.Ldloc, this.requestInfoLocal);
            this.ilGenerator.Emit(OpCodes.Ldstr, attribute.Name);
            this.ilGenerator.Emit(OpCodes.Ldarg_0);
            this.ilGenerator.Emit(OpCodes.Ldfld, property.FieldBuilder);
            this.LoadString(attribute.Value);
            this.LoadString(attribute.Format);
            this.ilGenerator.Emit(OpCodes.Callvirt, typedMethod);
        }
コード例 #7
0
 public void EmitAddHttpRequestMessagePropertyProperty(EmittedProperty property)
 {
     this.writer.WriteLine(this.requestInfoLocalName + ".AddHttpRequestMessagePropertyProperty(" +
                           QuoteString(property.PropertyModel.HttpRequestMessagePropertyAttributeKey) + ", " +
                           ReferenceTo(property.PropertyModel) + ");");
 }