private string Methods(string coreLibraryName) { StringBuilder sb = new StringBuilder(); foreach (var instance in _instances) { string responseType = instance.GetClientResponseType(coreLibraryName); string requestType = instance.GetClientRequestType(coreLibraryName); string call = "Call"; string callGenericArguments = $"{requestType}, {responseType}"; //if (instance is IStatefulServiceInstance ssi) //{ // call = "StatefulCall"; // string stateType = ssi.GetStateType(coreLibraryName); // string triggerType = ssi.GetTriggerType(coreLibraryName); // string dataType = ssi.GetDataType(coreLibraryName); // callGenericArguments = $"{requestType}, {responseType}, {stateType}, {triggerType}, {dataType}"; //} var s = $@" public Task<ServiceResponse<{responseType}>> {instance.Name}({requestType} request, CancellationToken cancellationToken){{ var url =""{_resolver.GetRegisteredNameFromFullName(instance.FullName)}""; _logger.LogInformation(""Calling {{url}} with correlation id {{correlationId}}"", url, request.CorrelationId); return {call}<{callGenericArguments}>(url, request, cancellationToken); }} public async Task<{responseType}> {instance.Name}Easy({requestType} request){{ var url =""{_resolver.GetRegisteredNameFromFullName(instance.FullName)}""; _logger.LogInformation(""Calling {{url}} with correlation id {{correlationId}}"", url, request.CorrelationId); var response = await {call}<{callGenericArguments}>(url, request, CancellationToken.None); if (response.MetaData.Result.Outcome() == ResultOutcome.Successful) {{ return response.Data; }} throw new ServiceCallException<ServiceResponse<{responseType}>>(response); }} public async Task<{responseType}> {instance.Name}Easy({requestType} request, CancellationToken cancellationToken){{ var url =""{_resolver.GetRegisteredNameFromFullName(instance.FullName)}""; _logger.LogInformation(""Calling {{url}} with correlation id {{correlationId}}"", url, request.CorrelationId); var response = await {call}<{callGenericArguments}>(url, request, cancellationToken); if (response.MetaData.Result.Outcome() == ResultOutcome.Successful) {{ return response.Data; }} throw new ServiceCallException<ServiceResponse<{responseType}>>(response); }} public Task<ServiceResponse<{responseType}>> {instance.Name}(IServiceInstance callingService, {requestType} request, CancellationToken cancellationToken){{ request.CorrelationId = callingService.CorrelationId; request.SessionId = callingService.SessionId; return {instance.Name}(request, cancellationToken); }} "; sb.AppendLine(s); sb.AppendLine(); } return(sb.ToString()); }