Beispiel #1
0
        public ProtoBufServiceMap(ISerializerCache serializerCache, OperationDefinition operationDefinition, RequestValueDefinition requestValueDefinition, ResponseValueDefinition responseValueDefinition, ITypeMap inputTypeMap, ITypeMap outputTypeMap)
            : base(serializerCache, operationDefinition, requestValueDefinition, responseValueDefinition, inputTypeMap, outputTypeMap)
        {
            var requestType  = RequestValueDefinition.ParameterInfo?.ParameterType;
            var responseType = ResponseValueDefinition.ParameterInfo?.ParameterType;

            readRequestMethod   = BuildReadValueMethod(requestType);
            readResponseMethod  = BuildReadValueMethod(responseType);
            writeRequestMethod  = BuildWriteValueMethod(requestType);
            writeResponseMethod = BuildWriteValueMethod(responseType);
        }
Beispiel #2
0
        private static object ProcessValue(object value, ReadValueMethod readValueMethod)
        {
            if (!(value is Stream stream))
            {
                return(value);
            }

            stream.Position = 0;

            return(readValueMethod(stream));
        }
Beispiel #3
0
        private static object ProcessValue(object value, ReadValueMethod readValueMethod)
        {
            var stream = value as Stream;

            if (stream == null)
            {
                return(value);
            }

            stream.Position = 0;

            return(readValueMethod(stream));
        }