當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。