Beispiel #1
0
        /// <summary>
        /// Get the invocation args for an invocation with an async method
        /// </summary>
        public string GetAsyncMethodInvocationArgs(string customHeaderReference)
        {
            List <string> invocationParams = new List <string>();

            LocalParameters.ForEach(p => invocationParams.Add(p.Name));
            invocationParams.Add(customHeaderReference);
            invocationParams.Add("cancellationToken");
            return(string.Join(", ", invocationParams));
        }
Beispiel #2
0
        /// <summary>
        /// Generate the method parameter declaration.
        /// </summary>
        /// <param name="includePkgName">Pass true if the type name should include the package prefix.  Defaults to false.</param>
        public string MethodParametersSignature(bool includePkgName = false)
        {
            var declarations = new List <string> {
                "ctx context.Context"
            };

            LocalParameters
            .ForEach(p => declarations.Add(string.Format(
                                               p.IsRequired || p.ModelType.CanBeEmpty()
                                                        ? "{0} {1}"
                                                        : "{0} *{1}", p.Name, p.ModelType.HasInterface()
                                                            ? p.ModelType.GetInterfaceName(includePkgName)
                                                            : ParameterTypeSig(p.ModelType, includePkgName))));
            return(string.Join(", ", declarations));
        }