本文整理汇总了C#中IEdmModel.SaveEpmAnnotationsForProperty方法的典型用法代码示例。如果您正苦于以下问题:C# IEdmModel.SaveEpmAnnotationsForProperty方法的具体用法?C# IEdmModel.SaveEpmAnnotationsForProperty怎么用?C# IEdmModel.SaveEpmAnnotationsForProperty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IEdmModel
的用法示例。
在下文中一共展示了IEdmModel.SaveEpmAnnotationsForProperty方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SaveODataAnnotationsImplementation
/// <summary>
/// Turns the in-memory representations of the supported, OData-specific annotations into their serializable form.
/// Assumes that the entity type and the model have been validated.
/// </summary>
/// <param name="model">The <see cref="IEdmModel"/> containing the annotations.</param>
/// <param name="entityType">The <see cref="IEdmEntityType"/> to process.</param>
private static void SaveODataAnnotationsImplementation(IEdmModel model, IEdmEntityType entityType)
{
Debug.Assert(model != null, "model != null");
Debug.Assert(entityType != null, "entityType != null");
// Get the cached EPM information for this entity type; if the mappings have changed this will update the cache;
// if all the mappings have been removed, we will delete the cache.
// Building the cache will also validate the EPM (since we don't want to save/write invalid EPM information).
// NOTE: when saving annotations on a model we assume it is valid and thus pass int.MaxValue for the maxMappingCount.
ODataEntityPropertyMappingCache epmCache = model.EnsureEpmCache(entityType, /*maxMappingCount*/ int.MaxValue);
if (epmCache != null)
{
// write any mappings for properties that are not declared on this type on the entity type
model.SaveEpmAnnotations(entityType, epmCache.MappingsForInheritedProperties, false, false);
IEnumerable<IEdmProperty> declaredProperties = entityType.DeclaredProperties;
if (declaredProperties != null)
{
foreach (IEdmProperty property in declaredProperties)
{
if (property.Type.IsODataPrimitiveTypeKind() || property.Type.IsODataComplexTypeKind())
{
model.SaveEpmAnnotationsForProperty(property, epmCache);
}
else if (property.Type.IsNonEntityODataCollectionTypeKind())
{
model.SaveEpmAnnotationsForProperty(property, epmCache);
}
}
}
}
}
示例2: SaveODataAnnotationsImplementation
private static void SaveODataAnnotationsImplementation(IEdmModel model, IEdmEntityType entityType)
{
ODataEntityPropertyMappingCache epmCache = model.EnsureEpmCache(entityType, 0x7fffffff);
if (epmCache != null)
{
model.SaveEpmAnnotations(entityType, epmCache.MappingsForInheritedProperties, false, false);
IEnumerable<IEdmProperty> declaredProperties = entityType.DeclaredProperties;
if (declaredProperties != null)
{
foreach (IEdmProperty property in declaredProperties)
{
if (property.Type.IsODataPrimitiveTypeKind() || property.Type.IsODataComplexTypeKind())
{
model.SaveEpmAnnotationsForProperty(property, epmCache);
}
else if (property.Type.IsNonEntityODataCollectionTypeKind())
{
model.SaveEpmAnnotationsForProperty(property, epmCache);
}
}
}
}
}