示例#1
0
        private MethodJva GetPagingNextMethodWithInvocation(out string invocation, bool async = false, bool singlePage = true)
        {
            String methodSuffixString = "WithServiceResponse";

            if (singlePage)
            {
                methodSuffixString = "SinglePage";
            }
            if (IsPagingNextOperation)
            {
                invocation = Name + methodSuffixString + (async ? "Async" : "");
                return(this);
            }
            string name  = this.Extensions.GetValue <Fixable <string> >("nextMethodName")?.ToCamelCase();
            string group = this.Extensions.GetValue <Fixable <string> >("nextMethodGroup")?.ToCamelCase();

            group = CodeNamerJva.Instance.GetMethodGroupName(group);
            var methodModel =
                CodeModel.Methods.FirstOrDefault(m =>
                                                 (group == null ? m.Group == null : group.Equals(m.Group, StringComparison.OrdinalIgnoreCase)) &&
                                                 m.Name.ToString().Equals(name, StringComparison.OrdinalIgnoreCase)) as MethodJva;

            group = group.ToPascalCase();
            name  = name + methodSuffixString;
            if (async)
            {
                name = name + "Async";
            }
            if (group == null || this.Group == methodModel.Group)
            {
                invocation = name;
            }
            else
            {
                invocation = string.Format(CultureInfo.InvariantCulture, "{0}.get{1}().{2}", ClientReference.Replace("this.", ""), group, name);
            }
            return(methodModel);
        }
示例#2
0
        private AzureMethodTemplateModel GetPagingNextMethod(out string invocation, bool async = false)
        {
            string name        = ((string)this.Extensions["nextMethodName"]).ToCamelCase();
            string group       = (string)this.Extensions["nextMethodGroup"];
            var    methodModel = new AzureMethodTemplateModel(
                ServiceClient.Methods.FirstOrDefault(m =>
                                                     group == null ? m.Group == null : group.Equals(m.Group, StringComparison.OrdinalIgnoreCase) &&
                                                     m.Name.Equals(name, StringComparison.OrdinalIgnoreCase)), ServiceClient);

            group = group.ToPascalCase();
            if (group != null)
            {
                group += "Operations";
            }
            if (async)
            {
                name = name + "Async";
            }
            if (group == null || this.OperationName == methodModel.OperationName)
            {
                invocation = name;
            }
            else
            {
                invocation = string.Format(CultureInfo.InvariantCulture, "{0}.get{1}().{2}", ClientReference.Replace("this.", ""), group, name);
            }
            return(methodModel);
        }
        private AzureMethodTemplateModel GetPagingNextMethodWithInvocation(out string invocation, bool async = false, bool singlePage = true)
        {
            String methodSuffixString = "WithServiceResponse";

            if (singlePage)
            {
                methodSuffixString = "SinglePage";
            }
            if (IsPagingNextOperation)
            {
                invocation = Name + methodSuffixString + (async ? "Async" : "");
                return(this);
            }
            string name        = ((string)this.Extensions["nextMethodName"]).ToCamelCase();
            string group       = _namer.GetMethodGroupName((string)this.Extensions["nextMethodGroup"]);
            var    methodModel = new AzureMethodTemplateModel(
                ServiceClient.Methods.FirstOrDefault(m =>
                                                     (group == null ? m.Group == null : group.Equals(m.Group, StringComparison.OrdinalIgnoreCase)) &&
                                                     m.Name.Equals(name, StringComparison.OrdinalIgnoreCase)), ServiceClient);

            group = group.ToPascalCase();
            name  = name + methodSuffixString;
            if (async)
            {
                name = name + "Async";
            }
            if (group == null || this.OperationName == methodModel.OperationName)
            {
                invocation = name;
            }
            else
            {
                invocation = string.Format(CultureInfo.InvariantCulture, "{0}.get{1}().{2}", ClientReference.Replace("this.", ""), group, name);
            }
            return(methodModel);
        }