Пример #1
0
 /// <summary>
 /// Initializes a new instance of the ThriftMethod class with the specified values.
 /// </summary>
 public ThriftMethod(string name, bool isOneWay,
                     ThriftReturnValue returnValue,
                     IReadOnlyList <ThriftThrowsClause> exceptions,
                     IReadOnlyList <ThriftParameter> parameters)
 {
     Name        = name;
     IsOneWay    = isOneWay;
     ReturnValue = returnValue;
     Exceptions  = exceptions;
     Parameters  = parameters;
 }
Пример #2
0
        /// <summary>
        /// Creates a virtual wire field representing a return value.
        /// </summary>
        public static ThriftWireField ReturnValue(ThriftReturnValue value, Expression returnValueVar, Expression hasReturnValueVar)
        {
            Func <Expression, Expression> setter = e => Expression.Block(
                Expression.Assign(returnValueVar, e),
                Expression.Assign(hasReturnValueVar, Expression.Constant(true))
                );

            return(new ThriftWireField(0, null,
                                       value.WireType, value.UnderlyingTypeInfo,
                                       ThriftWireFieldState.Optional, null,
                                       value.Converter,
                                       returnValueVar, setter));
        }