本文整理汇总了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;
}
示例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;
}
示例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);
}
}
示例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;
}
示例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)));
}
示例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);
}
示例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);
}
示例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);
}
示例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)));
}
示例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;
}
}
示例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>();
}
示例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 = "";
}
}
示例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);
}
示例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";
}
}
示例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)));
}