本文整理汇总了C#中Microsoft.Rest.Generator.ClientModel.CompositeType类的典型用法代码示例。如果您正苦于以下问题:C# CompositeType类的具体用法?C# CompositeType怎么用?C# CompositeType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CompositeType类属于Microsoft.Rest.Generator.ClientModel命名空间,在下文中一共展示了CompositeType类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: GetDependencyTypes
private IEnumerable<CompositeType> GetDependencyTypes(CompositeType type)
{
List<CompositeType> result = new List<CompositeType>()
{
type.BaseModelType
};
return result;
}
开发者ID:tonytang-microsoft-com,项目名称:autorest,代码行数:8,代码来源:RequirementsTemplateModel.cs
示例2: ModelTemplateModel
public ModelTemplateModel(CompositeType source, ServiceClient serviceClient)
{
this.LoadFrom(source);
ServiceClient = serviceClient;
if(source.BaseModelType != null)
{
_parent = new ModelTemplateModel(source.BaseModelType, serviceClient);
}
}
开发者ID:juvchan,项目名称:autorest,代码行数:9,代码来源:ModelTemplateModel.cs
示例3: ModelTemplateModel
public ModelTemplateModel(CompositeType source)
{
this.LoadFrom(source);
PropertyTemplateModels = new List<PropertyTemplateModel>();
source.Properties.ForEach(p => PropertyTemplateModels.Add(new PropertyTemplateModel(p)));
if (source.BaseModelType != null)
{
this._baseModel = new ModelTemplateModel(source.BaseModelType);
}
}
开发者ID:tonytang-microsoft-com,项目名称:autorest,代码行数:10,代码来源:ModelTemplateModel.cs
示例4: ModelTemplateModel
/// <summary>
/// Initializes a new instance of the ModelTemplateModel class.
/// </summary>
/// <param name="source">The object to create model from.</param>
/// <param name="serviceClient">The service client.</param>
public ModelTemplateModel(CompositeType source, ServiceClient serviceClient)
{
this.LoadFrom(source);
PropertyTemplateModels = new List<PropertyTemplateModel>();
source.Properties.ForEach(p => PropertyTemplateModels.Add(new PropertyTemplateModel(p)));
if (source.BaseModelType != null)
{
parent = new ModelTemplateModel(source.BaseModelType, serviceClient);
}
}
开发者ID:juvchan,项目名称:autorest,代码行数:16,代码来源:ModelTemplateModel.cs
示例5: ModelTemplateModel
public ModelTemplateModel(CompositeType source, ServiceClient serviceClient)
{
this.LoadFrom(source);
ServiceClient = serviceClient;
if(source.BaseModelType != null)
{
_parent = new ModelTemplateModel(source.BaseModelType, serviceClient);
}
_namer = new JavaCodeNamer(serviceClient.Namespace);
PropertyModels = new List<PropertyModel>();
Properties.ForEach(p => PropertyModels.Add(new PropertyModel(p, serviceClient.Namespace)));
}
开发者ID:Ranjana1996,项目名称:autorest,代码行数:12,代码来源:ModelTemplateModel.cs
示例6: BuildOptionsParameterTemplateModel
private void BuildOptionsParameterTemplateModel()
{
CompositeType optionsType;
optionsType = new CompositeType
{
Name = "options",
SerializedName = "options",
Documentation = "Optional Parameters."
};
var optionsParmeter = new Parameter
{
Name = "options",
SerializedName = "options",
IsRequired = false,
Documentation = "Optional Parameters.",
Location = ParameterLocation.None,
Type = optionsType
};
IEnumerable<ParameterTemplateModel> optionalParameters = LocalParameters.Where(p => !p.IsRequired);
foreach (ParameterTemplateModel parameter in optionalParameters)
{
Property optionalProperty = new Property
{
IsReadOnly = false,
Name = parameter.Name,
IsRequired = parameter.IsRequired,
DefaultValue = parameter.DefaultValue,
Documentation = parameter.Documentation,
Type = parameter.Type,
SerializedName = parameter.SerializedName
};
parameter.Constraints.ToList().ForEach(x => optionalProperty.Constraints.Add(x.Key, x.Value));
parameter.Extensions.ToList().ForEach(x => optionalProperty.Extensions.Add(x.Key, x.Value));
((CompositeType)optionsParmeter.Type).Properties.Add(optionalProperty);
}
//Adding customHeaders to the options object
Property customHeaders = new Property
{
IsReadOnly = false,
Name = "customHeaders",
IsRequired = false,
Documentation = "Headers that will be added to the request",
Type = new PrimaryType(KnownPrimaryType.Object),
SerializedName = "customHeaders"
};
((CompositeType)optionsParmeter.Type).Properties.Add(customHeaders);
OptionsParameterTemplateModel = new ParameterTemplateModel(optionsParmeter);
}
开发者ID:Ranjana1996,项目名称:autorest,代码行数:50,代码来源:MethodTemplateModel.cs
示例7: ModelTemplateModel
public ModelTemplateModel(CompositeType source, ServiceClient serviceClient)
{
if (!string.IsNullOrEmpty(source.PolymorphicDiscriminator))
{
if (!source.Properties.Any(p => p.Name == source.PolymorphicDiscriminator))
{
var polymorphicProperty = new Property
{
IsRequired = true,
Name = source.PolymorphicDiscriminator,
SerializedName = source.PolymorphicDiscriminator,
Documentation = "Polymorphic Discriminator",
Type = new PrimaryType(KnownPrimaryType.String) { Name = "str" }
};
source.Properties.Add(polymorphicProperty);
}
}
this.LoadFrom(source);
ServiceClient = serviceClient;
if (ServiceClient.ErrorTypes.Contains(source))
{
_isException = true;
}
if (source.BaseModelType != null)
{
_parent = new ModelTemplateModel(source.BaseModelType, serviceClient);
}
foreach (var property in ComposedProperties)
{
if (string.IsNullOrWhiteSpace(property.DefaultValue))
{
property.DefaultValue = PythonConstants.None;
}
}
if (this.IsPolymorphic)
{
foreach (var modelType in ServiceClient.ModelTypes)
{
if (modelType.BaseModelType == source)
{
_subModelTypes.Add(modelType);
}
}
}
}
开发者ID:tdjastrzebski,项目名称:autorest,代码行数:49,代码来源:ModelTemplateModel.cs
示例8: ParseWithServiceClientWithCreateResourceMethod
public void ParseWithServiceClientWithCreateResourceMethod()
{
ServiceClient serviceClient = new ServiceClient();
Parameter body = new Parameter()
{
Location = ParameterLocation.Body,
Type = new CompositeType(),
};
CompositeType responseBody = new CompositeType();
responseBody.Extensions.Add("x-ms-azure-resource", true);
const string url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Mock.Provider/mockResourceNames/{mockResourceName}";
Method method = CreateMethod(body: body, responseBody: responseBody, url: url);
serviceClient.Methods.Add(method);
IDictionary<string, ResourceSchema> schemas = ResourceSchemaParser.Parse(serviceClient);
Assert.NotNull(schemas);
Assert.Equal(1, schemas.Count);
ResourceSchema schema = schemas["Mock.Provider"];
Assert.Null(schema.Id);
Assert.Equal("http://json-schema.org/draft-04/schema#", schema.Schema);
Assert.Equal("Mock.Provider", schema.Title);
Assert.Equal("Mock Provider Resource Types", schema.Description);
Assert.Equal(1, schema.ResourceDefinitions.Count);
Assert.Equal("mockResourceNames", schema.ResourceDefinitions.Keys.Single());
Assert.Equal(
new JsonSchema()
{
JsonType = "object",
Description = "Mock.Provider/mockResourceNames"
}
.AddProperty("type", new JsonSchema()
{
JsonType = "string"
}
.AddEnum("Mock.Provider/mockResourceNames"),
true),
schema.ResourceDefinitions["mockResourceNames"]);
Assert.NotNull(schema.Definitions);
Assert.Equal(0, schema.Definitions.Count);
}
开发者ID:xingwu1,项目名称:autorest,代码行数:46,代码来源:ResourceSchemaParserTests.cs
示例9: NormalizePaginatedMethods
/// <summary>
/// Changes paginated method signatures to return Page type.
/// </summary>
/// <param name="serviceClient"></param>
public virtual void NormalizePaginatedMethods(ServiceClient serviceClient)
{
if (serviceClient == null)
{
throw new ArgumentNullException("serviceClient");
}
var pageTypeFormat = "Page<{0}>";
var convertedTypes = new Dictionary<IType, CompositeType>();
foreach (var method in serviceClient.Methods.Where(m => m.Extensions.ContainsKey(AzureCodeGenerator.PageableExtension)))
{
foreach (var responseStatus in method.Responses.Where(r => r.Value is CompositeType).Select(s => s.Key).ToArray())
{
var compositType = (CompositeType) method.Responses[responseStatus];
var sequenceType = compositType.Properties.Select(p => p.Type).FirstOrDefault(t => t is SequenceType) as SequenceType;
// if the type is a wrapper over page-able response
if(sequenceType != null &&
compositType.Properties.Count == 2 &&
compositType.Properties.Any(p => p.SerializedName.Equals("nextLink", StringComparison.OrdinalIgnoreCase)))
{
var pagableTypeName = string.Format(CultureInfo.InvariantCulture, pageTypeFormat, sequenceType.ElementType.Name);
CompositeType pagedResult = new CompositeType
{
Name = pagableTypeName
};
pagedResult.Extensions[AzureCodeGenerator.ExternalExtension] = true;
convertedTypes[method.Responses[responseStatus]] = pagedResult;
method.Responses[responseStatus] = pagedResult;
}
}
if (convertedTypes.ContainsKey(method.ReturnType))
{
method.ReturnType = convertedTypes[method.ReturnType];
}
}
AzureCodeGenerator.RemoveUnreferencedTypes(serviceClient, convertedTypes.Keys.Cast<CompositeType>().Select(t => t.Name));
}
开发者ID:tonytang-microsoft-com,项目名称:autorest,代码行数:48,代码来源:AzureCSharpCodeNamer.cs
示例10: ModelTemplateModel
public ModelTemplateModel(CompositeType source, ServiceClient serviceClient)
{
if (!string.IsNullOrEmpty(source.PolymorphicDiscriminator))
{
if (!source.Properties.Any(p => p.Name == source.PolymorphicDiscriminator))
{
var polymorphicProperty = new Property
{
IsRequired = true,
Name = source.PolymorphicDiscriminator,
SerializedName = source.PolymorphicDiscriminator,
Documentation = "Polymorhpic Discriminator",
Type = PrimaryType.String
};
source.Properties.Add(polymorphicProperty);
}
}
this.LoadFrom(source);
ServiceClient = serviceClient;
if (source.BaseModelType != null)
{
_parent = new ModelTemplateModel(source.BaseModelType, serviceClient);
}
}
开发者ID:DebugOfTheRoad,项目名称:autorest,代码行数:24,代码来源:ModelTemplateModel.cs
示例11: NormalizePaginatedMethods
/// <summary>
/// Changes paginated method signatures to return Page type.
/// </summary>
/// <param name="serviceClient"></param>
private void NormalizePaginatedMethods(ServiceClient serviceClient)
{
if (serviceClient == null)
{
throw new ArgumentNullException("serviceClient");
}
var convertedTypes = new Dictionary<IType, Response>();
foreach (var method in serviceClient.Methods.Where(m => m.Extensions.ContainsKey(AzureExtensions.PageableExtension)))
{
foreach (var responseStatus in method.Responses.Where(r => r.Value.Body is CompositeType).Select(s => s.Key))
{
var compositType = (CompositeType)method.Responses[responseStatus].Body;
var sequenceType = compositType.Properties.Select(p => p.Type).FirstOrDefault(t => t is SequenceType) as SequenceType;
// if the type is a wrapper over page-able response
if (sequenceType != null)
{
string pagableTypeName = GetPagingSetting(method.Extensions, sequenceType.ElementType.Name);
CompositeType pagedResult = new CompositeType
{
Name = pagableTypeName
};
convertedTypes[compositType] = new Response(pagedResult, null);
method.Responses[responseStatus] = convertedTypes[compositType];
break;
}
}
if (convertedTypes.ContainsKey(method.ReturnType.Body))
{
method.ReturnType = convertedTypes[method.ReturnType.Body];
}
}
AzureExtensions.RemoveUnreferencedTypes(serviceClient, convertedTypes.Keys.Cast<CompositeType>().Select(t => t.Name));
}
开发者ID:CamSoper,项目名称:autorest,代码行数:44,代码来源:AzurePythonCodeGenerator.cs
示例12: BuildServiceType
public override IType BuildServiceType(string serviceTypeName)
{
// Check if already generated
if (serviceTypeName != null && Modeler.GeneratedTypes.ContainsKey(serviceTypeName))
{
return Modeler.GeneratedTypes[serviceTypeName];
}
_schema = Modeler.Resolver.Unwrap(_schema);
// If primitive type
if ((_schema.Type != null && _schema.Type != DataType.Object) ||
_schema.AdditionalProperties != null)
{
return _schema.GetBuilder(Modeler).ParentBuildServiceType(serviceTypeName);
}
// If the object does not have any properties, treat it as raw json (i.e. object)
if (_schema.Properties.IsNullOrEmpty() && string.IsNullOrEmpty(_schema.Extends))
{
return PrimaryType.Object;
}
// Otherwise create new object type
var objectType = new CompositeType
{
Name = serviceTypeName,
SerializedName = serviceTypeName,
Documentation = _schema.Description
};
// Put this in already generated types serializationProperty
Modeler.GeneratedTypes[serviceTypeName] = objectType;
if (_schema.Properties != null)
{
// Visit each property and recursively build service types
foreach (var property in _schema.Properties)
{
string name = property.Key;
if (name != _schema.Discriminator)
{
string propertyServiceTypeName;
if (property.Value.Reference != null)
{
propertyServiceTypeName = property.Value.Reference.StripDefinitionPath();
}
else
{
propertyServiceTypeName = serviceTypeName + "_" + property.Key;
}
var propertyType =
property.Value.GetBuilder(Modeler).BuildServiceType(propertyServiceTypeName);
var propertyObj = new Property
{
Name = name,
SerializedName = name,
Type = propertyType,
IsRequired = property.Value.IsRequired
};
//propertyObj.Type = objectType;
propertyObj.Documentation = property.Value.Description;
var enumType = propertyType as EnumType;
if (enumType != null)
{
if (propertyObj.Documentation == null)
{
propertyObj.Documentation = string.Empty;
}
else
{
propertyObj.Documentation = propertyObj.Documentation.TrimEnd('.') + ". ";
}
propertyObj.Documentation += "Possible values for this property include: " +
string.Join(", ", enumType.Values.Select(v =>
string.Format(CultureInfo.InvariantCulture,
"'{0}'", v.Name))) + ".";
}
propertyObj.IsReadOnly = property.Value.ReadOnly;
objectType.Properties.Add(propertyObj);
}
else
{
objectType.PolymorphicDiscriminator = name;
}
}
}
// Copy over extensions
_schema.Extensions.ForEach(e => objectType.Extensions[e.Key] = e.Value);
// Put this in the extended type serializationProperty for building method return type in the end
if (_schema.Extends != null)
{
Modeler.ExtendedTypes[serviceTypeName] = _schema.Extends.StripDefinitionPath();
}
return objectType;
}
开发者ID:tonytang-microsoft-com,项目名称:autorest,代码行数:100,代码来源:SchemaBuilder.cs
示例13: AzureCompositeTypeModel
public AzureCompositeTypeModel(CompositeType compositeType, string package)
: this(package)
{
this.LoadFrom(compositeType);
}
开发者ID:Ranjana1996,项目名称:autorest,代码行数:5,代码来源:AzureCompositeTypeModel.cs
示例14: BuildServiceType
public override IType BuildServiceType(string serviceTypeName)
{
// Check if already generated
if (serviceTypeName != null && Modeler.GeneratedTypes.ContainsKey(serviceTypeName))
{
return Modeler.GeneratedTypes[serviceTypeName];
}
_schema = Modeler.Resolver.Unwrap(_schema);
// If primitive type
if ((_schema.Type != null && _schema.Type != DataType.Object) ||
_schema.AdditionalProperties != null)
{
return _schema.GetBuilder(Modeler).ParentBuildServiceType(serviceTypeName);
}
// If object with file format treat as stream
if (_schema.Type != null
&& _schema.Type == DataType.Object
&& "file".Equals(SwaggerObject.Format, StringComparison.OrdinalIgnoreCase))
{
return PrimaryType.Stream;
}
// If the object does not have any properties, treat it as raw json (i.e. object)
if (_schema.Properties.IsNullOrEmpty() && string.IsNullOrEmpty(_schema.Extends))
{
return PrimaryType.Object;
}
// Otherwise create new object type
var objectType = new CompositeType
{
Name = serviceTypeName,
SerializedName = serviceTypeName,
Documentation = _schema.Description
};
// Put this in already generated types serializationProperty
Modeler.GeneratedTypes[serviceTypeName] = objectType;
if (_schema.Properties != null)
{
// Visit each property and recursively build service types
foreach (var property in _schema.Properties)
{
string name = property.Key;
if (name != _schema.Discriminator)
{
string propertyServiceTypeName;
if (property.Value.Reference != null)
{
propertyServiceTypeName = property.Value.Reference.StripDefinitionPath();
}
else
{
propertyServiceTypeName = serviceTypeName + "_" + property.Key;
}
var propertyType =
property.Value.GetBuilder(Modeler).BuildServiceType(propertyServiceTypeName);
var propertyObj = new Property
{
Name = name,
SerializedName = name,
Type = propertyType,
IsRequired = property.Value.IsRequired,
IsReadOnly = property.Value.ReadOnly,
DefaultValue = property.Value.Default
};
SetConstraints(propertyObj.Constraints, property.Value);
//propertyObj.Type = objectType;
propertyObj.Documentation = property.Value.Description;
var enumType = propertyType as EnumType;
if (enumType != null)
{
if (propertyObj.Documentation == null)
{
propertyObj.Documentation = string.Empty;
}
else
{
propertyObj.Documentation = propertyObj.Documentation.TrimEnd('.') + ". ";
}
propertyObj.Documentation += "Possible values for this property include: " +
string.Join(", ", enumType.Values.Select(v =>
string.Format(CultureInfo.InvariantCulture,
"'{0}'", v.Name))) + ".";
}
objectType.Properties.Add(propertyObj);
}
else
{
objectType.PolymorphicDiscriminator = name;
}
}
}
// Copy over extensions
//.........这里部分代码省略.........
开发者ID:maxkeller,项目名称:autorest,代码行数:101,代码来源:SchemaBuilder.cs
示例15: ResourceIsFlattenedForConflictingResource
public void ResourceIsFlattenedForConflictingResource()
{
var serviceClient = new ServiceClient();
serviceClient.BaseUrl = "https://petstore.swagger.wordnik.com";
serviceClient.ApiVersion = "1.0.0";
serviceClient.Documentation =
"A sample API that uses a petstore as an example to demonstrate features in the swagger-2.0 specification";
serviceClient.Name = "Swagger Petstore";
var getPet = new Method();
var resource = new CompositeType();
var dogProperties = new CompositeType();
var dog = new CompositeType();
serviceClient.Methods.Add(getPet);
resource.Name = "resource";
resource.Extensions[AzureExtensions.AzureResourceExtension] = true;
resource.Properties.Add(new Property
{
Name = "id",
Type = PrimaryType.String,
IsRequired = true
});
resource.Properties.Add(new Property
{
Name = "location",
Type = PrimaryType.String,
IsRequired = true
});
resource.Properties.Add(new Property
{
Name = "name",
Type = PrimaryType.String,
IsRequired = true
});
resource.Properties.Add(new Property
{
Name = "tags",
Type = new SequenceType { ElementType = PrimaryType.String },
IsRequired = true
});
resource.Properties.Add(new Property
{
Name = "type",
Type = PrimaryType.String,
IsRequired = true
});
dogProperties.Name = "dogProperties";
dogProperties.Properties.Add(new Property
{
Name = "id",
Type = PrimaryType.Long,
IsRequired = true
});
dogProperties.Properties.Add(new Property
{
Name = "name",
Type = PrimaryType.String,
IsRequired = true
});
dog.Name = "dog";
dog.BaseModelType = resource;
dog.Properties.Add(new Property
{
Name = "properties",
Type = dogProperties,
IsRequired = true
});
dog.Properties.Add(new Property
{
Name = "pedigree",
Type = PrimaryType.Boolean,
IsRequired = true
});
getPet.ReturnType = new Response(dog, null);
serviceClient.ModelTypes.Add(resource);
serviceClient.ModelTypes.Add(dogProperties);
serviceClient.ModelTypes.Add(dog);
var codeGen = new SampleAzureCodeGenerator(new Settings());
codeGen.NormalizeClientModel(serviceClient);
Assert.Equal(3, serviceClient.ModelTypes.Count);
Assert.Equal("dog", serviceClient.ModelTypes.First(m => m.Name == "dog").Name);
Assert.Equal(3, serviceClient.ModelTypes.First(m => m.Name == "dog").Properties.Count);
Assert.True(serviceClient.ModelTypes.First(m => m.Name == "dog").Properties.Any(p => p.Name == "dogName"));
Assert.True(serviceClient.ModelTypes.First(m => m.Name == "dog").Properties.Any(p => p.Name == "dogId"));
Assert.True(serviceClient.ModelTypes.First(m => m.Name == "dog").Properties.Any(p => p.Name == "pedigree"));
Assert.Equal("dog", serviceClient.Methods[0].ReturnType.Body.Name);
Assert.Equal(serviceClient.ModelTypes.First(m => m.Name == "dog"), serviceClient.Methods[0].ReturnType.Body);
}
开发者ID:maxkeller,项目名称:autorest,代码行数:90,代码来源:AzureServiceClientNormalizerTests.cs
示例16: VerifyFirstPropertyIsByteArray
private void VerifyFirstPropertyIsByteArray(CompositeType serviceType)
{
var referenceKey = serviceType.Name;
var responseType = _swaggerModeler.GeneratedTypes[referenceKey];
var property = responseType.Properties.FirstOrDefault(p => p.Type is PrimaryType && ((PrimaryType)p.Type).Type == KnownPrimaryType.ByteArray);
if (property == null)
{
throw new KeyNotFoundException(
"Please specify a field with type of System.Byte[] to deserialize the file contents to");
}
}
开发者ID:Ranjana1996,项目名称:autorest,代码行数:11,代码来源:OperationBuilder.cs
示例17: NormalizePaginatedMethods
/// <summary>
/// Changes paginated method signatures to return Page type.
/// </summary>
/// <param name="serviceClient"></param>
/// <param name="pageClasses"></param>
public virtual void NormalizePaginatedMethods(ServiceClient serviceClient, IDictionary<KeyValuePair<string, string>, string> pageClasses)
{
if (serviceClient == null)
{
throw new ArgumentNullException("serviceClient");
}
var convertedTypes = new Dictionary<IType, CompositeType>();
foreach (var method in serviceClient.Methods.Where(m => m.Extensions.ContainsKey(AzureExtensions.PageableExtension)))
{
string nextLinkString;
string pageClassName = GetPagingSetting(method.Extensions, pageClasses, out nextLinkString);
if (string.IsNullOrEmpty(pageClassName))
{
continue;
}
var pageTypeFormat = "{0}<{1}>";
var ipageTypeFormat = "IPage<{0}>";
if (string.IsNullOrWhiteSpace(nextLinkString))
{
ipageTypeFormat = "IEnumerable<{0}>";
}
foreach (var responseStatus in method.Responses
.Where(r => r.Value.Body is CompositeType).Select(s => s.Key).ToArray())
{
var compositType = (CompositeType) method.Responses[responseStatus].Body;
var sequenceType = compositType.Properties.Select(p => p.Type).FirstOrDefault(t => t is SequenceType) as SequenceType;
// if the type is a wrapper over page-able response
if(sequenceType != null)
{
var pagableTypeName = string.Format(CultureInfo.InvariantCulture, pageTypeFormat, pageClassName, sequenceType.ElementType.Name);
var ipagableTypeName = string.Format(CultureInfo.InvariantCulture, ipageTypeFormat, sequenceType.ElementType.Name);
CompositeType pagedResult = new CompositeType
{
Name = pagableTypeName
};
pagedResult.Extensions[AzureExtensions.ExternalExtension] = true;
pagedResult.Extensions[AzureExtensions.PageableExtension] = ipagableTypeName;
convertedTypes[method.Responses[responseStatus].Body] = pagedResult;
method.Responses[responseStatus] = new Response(pagedResult, method.Responses[responseStatus].Headers);
}
}
if (convertedTypes.ContainsKey(method.ReturnType.Body))
{
method.ReturnType = new Response(convertedTypes[method.ReturnType.Body],
method.ReturnType.Headers);
}
}
AzureExtensions.RemoveUnreferencedTypes(serviceClient, convertedTypes.Keys.Cast<CompositeType>().Select(t => t.Name));
}
开发者ID:maxkeller,项目名称:autorest,代码行数:63,代码来源:AzureCSharpCodeNamer.cs
示例18: AzureModelTemplateModel
/// <summary>
/// Initializes a new instance of the AzureModelTemplateModel class.
/// </summary>
/// <param name="source">The object to create model from.</param>
public AzureModelTemplateModel(CompositeType source)
: base(source)
{
}
开发者ID:BretJohnson,项目名称:autorest,代码行数:8,代码来源:AzureModelTemplateModel.cs
示例19: NormalizeCompositeType
private IType NormalizeCompositeType(CompositeType compositeType)
{
compositeType.Name = GetTypeName(compositeType.Name);
foreach (var property in compositeType.Properties)
{
property.Name = GetPropertyName(property.GetClientName());
property.Type = NormalizeTypeReference(property.Type);
}
return compositeType;
}
开发者ID:Ranjana1996,项目名称:autorest,代码行数:12,代码来源:PythonCodeNamer.cs
示例20: IsAzureResource
/// <summary>
/// Determines a composite type as an External Resource if it's name equals "Resource"
/// and it has an extension named "x-ms-azure-resource" marked as true.
/// </summary>
/// <param name="compositeType">Type to determine if it is an external resource</param>
/// <returns>True if it is an external resource, false otherwise</returns>
public static bool IsAzureResource(CompositeType compositeType)
{
if (compositeType == null)
{
return false;
}
if (compositeType.ComposedExtensions.ContainsKey(AzureResourceExtension))
{
var external = compositeType.ComposedExtensions[AzureResourceExtension] as bool?;
return (external == null || external.Value);
}
return false;
}
开发者ID:Ranjana1996,项目名称:autorest,代码行数:21,代码来源:AzureExtensions.cs
注:本文中的Microsoft.Rest.Generator.ClientModel.CompositeType类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论