private void BuildServerStreamingResultAdapter(OperationDescription operation, string functionName) { var returnType = SyntaxTools.GetFullName(operation.Method.ReturnTypeSymbol.GenericTypeArguments()[0]); Output .Append("private static ") .Append(returnType) .Append(" ") .Append(functionName) .Append("(") .Append(nameof(ValueTuple)) .Append("<") .Append(operation.HeaderResponseType !.ClassName) .Append(", IAsyncEnumerable<") .Append(operation.ResponseType.Properties[0]) .Append(">>") .AppendLine("response)"); Output.AppendLine("{"); using (Output.Indent()) { Output.AppendLine("var message = response.Item1;"); Output .Append("return new ") .Append(returnType) .Append("("); // operation.ResponseTypeIndex; var propertiesCount = operation.HeaderResponseTypeInput.Length + 1; for (var i = 0; i < propertiesCount; i++) { string value; if (i == operation.ResponseTypeIndex) { value = "response.Item2"; } else { var index = Array.IndexOf(operation.HeaderResponseTypeInput, i) + 1; value = "message.Value" + index.ToString(CultureInfo.InvariantCulture); } if (i > 0) { Output.Append(", "); } Output.Append(value); } Output.AppendLine(");"); } Output.AppendLine("}"); }
public static bool Math(AttributeData attributeData) { return(attributeData.AttributeClass != null && "ServiceModel.Grpc.DesignTime.ExportGrpcServiceAttribute".Equals(SyntaxTools.GetFullName(attributeData.AttributeClass), StringComparison.Ordinal)); }