本文整理汇总了C#中Microsoft.Test.Taupo.Contracts.EntityModel.EntityModelSchema.Clone方法的典型用法代码示例。如果您正苦于以下问题:C# EntityModelSchema.Clone方法的具体用法?C# EntityModelSchema.Clone怎么用?C# EntityModelSchema.Clone使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Microsoft.Test.Taupo.Contracts.EntityModel.EntityModelSchema
的用法示例。
在下文中一共展示了EntityModelSchema.Clone方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ConvertToProductAnnotations
// TODO: Rename this converter; it converts from higher-level test annotations to the serializable
// annotations in CSDL.
/// <summary>
/// Performs the conversion.
/// </summary>
/// <param name="model">Model to perform conversion on.</param>
/// <returns>A clone of the <paramref name="model"/> with the converted annotations.</returns>
public EntityModelSchema ConvertToProductAnnotations(EntityModelSchema model)
{
// we have to clone the model here since we will modify it by adding the converted annotations;
// we do this in all cases even if there are no annotations to convert; if this becomes a performance problem
// we can change this going forward (to do the clone on-demand).
model = model.Clone();
// TODO: support for MimeTypeAnnotation on service operations and primitive properties
foreach (var entityType in model.EntityTypes)
{
if (entityType.HasStream())
{
var attribute = new XAttribute(ODataConstants.DataServicesMetadataNamespace.GetName(ODataConstants.HasStreamAttributeName), true);
AddAnnotationIfDoesntExist(entityType, new AttributeAnnotation(attribute));
}
}
return model;
}