本文整理汇总了C#中Microsoft.Test.Taupo.Contracts.EntityModel.EntityModelSchema.MinimumVersion方法的典型用法代码示例。如果您正苦于以下问题:C# EntityModelSchema.MinimumVersion方法的具体用法?C# EntityModelSchema.MinimumVersion怎么用?C# EntityModelSchema.MinimumVersion使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Microsoft.Test.Taupo.Contracts.EntityModel.EntityModelSchema
的用法示例。
在下文中一共展示了EntityModelSchema.MinimumVersion方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Convert
/// <summary>
/// Converts the <paramref name="entityModelSchema"/> to the corresponding
/// <see cref="IEdmModel"/> including the OData metadata annotations.
/// </summary>
/// <param name="entityModelSchema">The <see cref="EntityModelSchema"/> to convert.</param>
/// <param name="loadSerializableAnnotations">true if serializable annotations should be loaded into their user-friendly in-memory representation; otherwise false.</param>
/// <returns>The <see cref="IEdmModel"/> instance that corresponds to the <paramref name="entityModelSchema"/>.</returns>
public virtual IEdmModel Convert(EntityModelSchema entityModelSchema, bool loadSerializableAnnotations = true)
{
// TODO: This code is way too complex for what it does.
// The current implementation for the underlying converter does not directly convert from EntityModelSchema
// to IEdmModel; instead it serializes the entity model schema into Xml and then parses the Xml into an IEdmModel.
// Direct conversion of annotations does not work because of this. We need to go from test annotations on the
// entity model schema to attribute annotations on that entity model schema, then use the underlying converter,
// then convert the serializable annotations on the EDM model back into product annotations as needed.
//
// Talk to the EdmLib team whether we can use a direct converter instead!
//
// Also modify the implementation of DataServiceProviderFactory once this is fixed; we do another post-processing
// there that could be folded into a visitor pattern.
if (entityModelSchema == null)
{
return null;
}
// 1) Convert OData-specific test annotations to attribute annotations (this clones the model if needed)
entityModelSchema = this.SerializableToTestAnnotationConverter.ConvertToProductAnnotations(entityModelSchema);
// 2) Use the underlying converter to convert from entity model schema to Edm model
this.BaseEntityModelSchemaToEdmModelConverter.EdmVersion = entityModelSchema.MinimumVersion().ToEdmVersion();
IEdmModel model = this.BaseEntityModelSchemaToEdmModelConverter.ConvertToEdmModel(entityModelSchema);
Debug.Assert(model != null, "Expected non-null model");
if (loadSerializableAnnotations)
{
// 4) Because we have to go through Xml we cannot ensure the same order of the EPM annotations on the entity
// types we have to go fix this now.
FixEPMAnnotationOrder(entityModelSchema, model);
}
return model;
}