当前位置: 首页>>代码示例>>C#>>正文


C# ClientModel.Method类代码示例

本文整理汇总了C#中Microsoft.Rest.Generator.ClientModel.Method的典型用法代码示例。如果您正苦于以下问题:C# Method类的具体用法?C# Method怎么用?C# Method使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Method类属于Microsoft.Rest.Generator.ClientModel命名空间,在下文中一共展示了Method类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: MethodTemplateModel

 /// <summary>
 /// Initializes a new instance of the class MethodTemplateModel.
 /// </summary>
 /// <param name="source">The source object.</param>
 /// <param name="serviceClient">The service client.</param>
 public MethodTemplateModel(Method source, ServiceClient serviceClient)
 {
     this.LoadFrom(source);
     ParameterTemplateModels = new List<ParameterTemplateModel>();
     source.Parameters.ForEach(p => ParameterTemplateModels.Add(new ParameterTemplateModel(p)));
     ServiceClient = serviceClient;
 }
开发者ID:xingwu1,项目名称:autorest,代码行数:12,代码来源:MethodTemplateModel.cs

示例2: OnBuildMethodParameter

        public static StringBuilder OnBuildMethodParameter(Method method,
            SwaggerParameter currentSwaggerParam,
            StringBuilder paramNameBuilder)
        {
            if (currentSwaggerParam == null)
            {
                throw new ArgumentNullException("currentSwaggerParam");
            }

            bool hasCollectionFormat = currentSwaggerParam.CollectionFormat != CollectionFormat.None;

            if (currentSwaggerParam.Type == DataType.Array && !hasCollectionFormat)
            {
                // If the parameter type is array default the collectionFormat to csv
                currentSwaggerParam.CollectionFormat = CollectionFormat.Csv;
            }

            if (hasCollectionFormat)
            {
                AddCollectionFormat(currentSwaggerParam, paramNameBuilder);
                if (currentSwaggerParam.In == ParameterLocation.Path)
                {
                    if (method == null || method.Url == null)
                    {
                       throw new ArgumentNullException("method"); 
                    }

                    method.Url = method.Url.Replace(
                        string.Format(CultureInfo.InvariantCulture, "{0}", currentSwaggerParam.Name),
                        string.Format(CultureInfo.InvariantCulture, "{0}", paramNameBuilder));
                }
            }
            return paramNameBuilder;
        }
开发者ID:maxkeller,项目名称:autorest,代码行数:34,代码来源:CollectionFormatBuilder.cs

示例3: MethodTemplateModel

 public MethodTemplateModel(Method source, ServiceClient serviceClient)
 {
     this.LoadFrom(source);
     ParameterTemplateModels = new List<ParameterTemplateModel>();
     source.Parameters.ForEach(p => ParameterTemplateModels.Add(new ParameterTemplateModel(p)));
     ServiceClient = serviceClient;
     if (source.Group != null)
     {
         OperationName = source.Group.ToPascalCase();
     }
     else
     {
         OperationName = serviceClient.Name;
     }
     AddCustomHeader = true;
     string formatter;
     foreach (var parameter in LocalParameters)
     {
         if (string.IsNullOrWhiteSpace(parameter.DefaultValue))
         {
             parameter.DefaultValue = PythonConstants.None;
         }
     }
     foreach (Match m in Regex.Matches(Url, @"\{[\w]+:[\w]+\}"))
     {
         formatter = m.Value.Split(':').First() + '}';
         Url = Url.Replace(m.Value, formatter);
     }
 }
开发者ID:xingwu1,项目名称:autorest,代码行数:29,代码来源:MethodTemplateModel.cs

示例4: MethodTemplateModel

 public MethodTemplateModel(Method source, ServiceClient serviceClient)
 {
     this.LoadFrom(source);
     ParameterTemplateModels = new List<ParameterTemplateModel>();
     LogicalParameterTemplateModels = new List<ParameterTemplateModel>();
     source.Parameters.ForEach(p => ParameterTemplateModels.Add(new ParameterTemplateModel(p)));
     source.LogicalParameters.ForEach(p => LogicalParameterTemplateModels.Add(new ParameterTemplateModel(p)));
     ServiceClient = serviceClient;
     MethodGroupName = source.Group ?? serviceClient.Name;
 }
开发者ID:DebugOfTheRoad,项目名称:autorest,代码行数:10,代码来源:MethodTemplateModel.cs

示例5: AzureMethodTemplateModel

        /// <summary>
        /// Initializes a new instance of the AzureMethodTemplateModel class.
        /// </summary>
        /// <param name="source">The method current model is built for.</param>
        /// <param name="serviceClient">The service client - main point of access to the SDK.</param>
        public AzureMethodTemplateModel(Method source, ServiceClient serviceClient)
            : base(source, serviceClient)
        {
            if (source == null)
            {
                throw new ArgumentNullException("source");
            }

            ParameterTemplateModels.Clear();
            source.Parameters.ForEach(p => ParameterTemplateModels.Add(new AzureParameterTemplateModel(p)));
        }
开发者ID:tonytang-microsoft-com,项目名称:autorest,代码行数:16,代码来源:AzureMethodTemplateModel.cs

示例6: AzureMethodTemplateModel

 public AzureMethodTemplateModel(Method source, ServiceClient serviceClient)
     : base(source, serviceClient)
 {
     if (source == null)
     {
         throw new ArgumentNullException("source");
     }
     
     this.ClientRequestIdString = AzureExtensions.GetClientRequestIdString(source);
     this.RequestIdString = AzureExtensions.GetRequestIdString(source);
 }
开发者ID:DebugOfTheRoad,项目名称:autorest,代码行数:11,代码来源:AzureMethodTemplateModel.cs

示例7: MethodTemplateModel

 public MethodTemplateModel(Method source, ServiceClient serviceClient)
 {
     this.LoadFrom(source);
     ParameterTemplateModels = new List<ParameterTemplateModel>();
     LogicalParameterTemplateModels = new List<ParameterTemplateModel>();
     source.Parameters.ForEach(p => ParameterTemplateModels.Add(new ParameterTemplateModel(p)));
     source.LogicalParameters.ForEach(p => LogicalParameterTemplateModels.Add(new ParameterTemplateModel(p)));
     ServiceClient = serviceClient;
     MethodGroupName = source.Group ?? serviceClient.Name;
     this.IsCustomBaseUri = serviceClient.Extensions.ContainsKey(Microsoft.Rest.Generator.Extensions.ParameterizedHostExtension);
 }
开发者ID:jkonecki,项目名称:autorest,代码行数:11,代码来源:MethodTemplateModel.cs

示例8: AzureMethodTemplateModel

        /// <summary>
        /// Initializes a new instance of the AzureMethodTemplateModel class.
        /// </summary>
        /// <param name="source">The method current model is built for.</param>
        /// <param name="serviceClient">The service client - main point of access to the SDK.</param>
        public AzureMethodTemplateModel(Method source, ServiceClient serviceClient)
            : base(source, serviceClient)
        {
            if (source == null)
            {
                throw new ArgumentNullException("source");
            }

            ParameterTemplateModels.Clear();
            source.Parameters.ForEach(p => ParameterTemplateModels.Add(new AzureParameterTemplateModel(p)));

            this.ClientRequestIdString = AzureExtensions.GetClientRequestIdString(source);
            this.RequestIdString = AzureExtensions.GetRequestIdString(source);
        }
开发者ID:maxkeller,项目名称:autorest,代码行数:19,代码来源:AzureMethodTemplateModel.cs

示例9: AzureMethodTemplateModel

        public AzureMethodTemplateModel(Method source, ServiceClient serviceClient)
            : base(source, serviceClient)
        {
            if (source == null)
            {
                throw new ArgumentNullException("source");
            }

            this.ClientRequestIdString = AzureExtensions.GetClientRequestIdString(source);
            this.RequestIdString = AzureExtensions.GetRequestIdString(source);
            _returnTypeModel = new AzureResponseModel(ReturnType, this);
            _responseModels = new Dictionary<HttpStatusCode, ResponseModel>();
            Responses.ForEach(r => _responseModels.Add(r.Key, new AzureResponseModel(r.Value, this)));
        }
开发者ID:Ranjana1996,项目名称:autorest,代码行数:14,代码来源:AzureMethodTemplateModel.cs

示例10: MethodTemplateModel

 public MethodTemplateModel(Method source, ServiceClient serviceClient)
 {
     this.LoadFrom(source);
     ParameterTemplateModels = new List<ParameterTemplateModel>();
     source.Parameters.ForEach(p => ParameterTemplateModels.Add(new ParameterTemplateModel(p)));
     ServiceClient = serviceClient;
     if (source.Group != null)
     {
         OperationName = source.Group.ToPascalCase();
     }
     else
     {
         OperationName = serviceClient.Name;
     }
 }
开发者ID:tonytang-microsoft-com,项目名称:autorest,代码行数:15,代码来源:MethodTemplateModel.cs

示例11: ParameterModel

 public ParameterModel(Parameter parameter, Method method)
     : base()
 {
     this.LoadFrom(parameter);
     this._method = method;
     // Use instance type for optional parameters
     if (!this.IsRequired)
     {
         this.Type = ((ITypeModel) Type).InstanceType();
     }
     _wireName = this.Name.ToCamelCase();
     if (NeedsConversion)
     {
         _wireName += "Converted";
     }
     _implImports = new List<string>();
 }
开发者ID:Ranjana1996,项目名称:autorest,代码行数:17,代码来源:ParameterModel.cs

示例12: MethodTemplateModel

 public MethodTemplateModel(Method source, ServiceClient serviceClient)
 {
     this.LoadFrom(source);
     ParameterTemplateModels = new List<ParameterTemplateModel>();
     source.Parameters.Where(p => p.Location == ParameterLocation.Path).ForEach(p => ParameterTemplateModels.Add(new ParameterTemplateModel(p)));
     source.Parameters.Where(p => p.Location != ParameterLocation.Path).ForEach(p => ParameterTemplateModels.Add(new ParameterTemplateModel(p)));
     ServiceClient = serviceClient;
     if (source.Group != null)
     {
         OperationName = source.Group.ToPascalCase();
         ClientReference = "client";
     }
     else
     {
         OperationName = serviceClient.Name;
         ClientReference = "";
     }
 }
开发者ID:JamesTryand,项目名称:autorest,代码行数:18,代码来源:MethodTemplateModel.cs

示例13: AzureMethodTemplateModel

        public AzureMethodTemplateModel(Method source, ServiceClient serviceClient, SyncMethodsGenerationMode syncWrappers)
            : base(source, serviceClient, syncWrappers)
        {
            if (source == null)
            {
                throw new ArgumentNullException("source");
            }

            ParameterTemplateModels.Clear();
            LogicalParameterTemplateModels.Clear();
            source.Parameters.ForEach(p => ParameterTemplateModels.Add(new AzureParameterTemplateModel(p)));
            source.LogicalParameters.ForEach(p => LogicalParameterTemplateModels.Add(new AzureParameterTemplateModel(p)));
            if (MethodGroupName != ServiceClient.Name)
            {
                MethodGroupName = MethodGroupName + "Operations";
            }

            this.ClientRequestIdString = AzureExtensions.GetClientRequestIdString(source);
            this.RequestIdString = AzureExtensions.GetRequestIdString(source);
        }
开发者ID:xingwu1,项目名称:autorest,代码行数:20,代码来源:AzureMethodTemplateModel.cs

示例14: AzureMethodTemplateModel

        public AzureMethodTemplateModel(Method source, ServiceClient serviceClient)
            : base(source, serviceClient)
        {
            if (source == null)
            {
                throw new ArgumentNullException("source");
            }

            this.ClientRequestIdString = AzureExtensions.GetClientRequestIdString(source);
            this.RequestIdString = AzureExtensions.GetRequestIdString(source);
            _returnTypeModel = new AzureResponseModel(ReturnType, this);
            _responseModels = new Dictionary<HttpStatusCode, ResponseModel>();
            Responses.ForEach(r => _responseModels.Add(r.Key, new AzureResponseModel(r.Value, this)));

            if (this.IsPagingOperation || this.IsPagingNextOperation)
            {
                var ext = this.Extensions[AzureExtensions.PageableExtension] as Newtonsoft.Json.Linq.JContainer;
                pageClassName = (string)ext["className"] ?? "PageImpl";
            }
        }
开发者ID:xingwu1,项目名称:autorest,代码行数:20,代码来源:AzureMethodTemplateModel.cs

示例15: MethodTemplateModel

 public MethodTemplateModel(Method source, ServiceClient serviceClient)
 {
     this.LoadFrom(source);
     ParameterModels = new List<ParameterModel>();
     LogicalParameterModels = new List<ParameterModel>();
     source.Parameters.Where(p => p.Location == ParameterLocation.Path).ForEach(p => ParameterModels.Add(new ParameterModel(p, this)));
     source.Parameters.Where(p => p.Location != ParameterLocation.Path).ForEach(p => ParameterModels.Add(new ParameterModel(p, this)));
     source.LogicalParameters.ForEach(p => LogicalParameterModels.Add(new ParameterModel(p, this)));
     ServiceClient = serviceClient;
     if (source.Group != null)
     {
         OperationName = source.Group.ToPascalCase();
         ClientReference = "this.client";
     }
     else
     {
         OperationName = serviceClient.Name;
         ClientReference = "this";
     }
     _returnTypeModel = new ResponseModel(ReturnType);
     _responseModels = new Dictionary<HttpStatusCode,ResponseModel>();
     Responses.ForEach(r => _responseModels.Add(r.Key, new ResponseModel(r.Value)));
 }
开发者ID:Ranjana1996,项目名称:autorest,代码行数:23,代码来源:MethodTemplateModel.cs


注:本文中的Microsoft.Rest.Generator.ClientModel.Method类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。