本文整理汇总了C#中IEdmModel.LoadEpmAnnotations方法的典型用法代码示例。如果您正苦于以下问题:C# IEdmModel.LoadEpmAnnotations方法的具体用法?C# IEdmModel.LoadEpmAnnotations怎么用?C# IEdmModel.LoadEpmAnnotations使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IEdmModel
的用法示例。
在下文中一共展示了IEdmModel.LoadEpmAnnotations方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: LoadEpmAnnotations
/// <summary>
/// Loads the serializable EPM annotations on the given <paramref name="entityType"/> into their in-memory representation.
/// </summary>
/// <param name="model">The model the entity type belongs to.</param>
/// <param name="entityType">The <see cref="IEdmEntityType"/> to load the EPM annotations for.</param>
private static void LoadEpmAnnotations(IEdmModel model, IEdmEntityType entityType)
{
DebugUtils.CheckNoExternalCallers();
Debug.Assert(entityType != null, "entityType != null");
string entityTypeName = entityType.ODataFullName();
ODataEntityPropertyMappingCollection mappings = new ODataEntityPropertyMappingCollection();
// Load the annotations from the type (these are the mappings for properties not explicitly declared on this type)
model.LoadEpmAnnotations(entityType, mappings, entityTypeName, null /*property*/);
IEnumerable<IEdmProperty> declaredProperties = entityType.DeclaredProperties;
if (declaredProperties != null)
{
foreach (IEdmProperty property in declaredProperties)
{
// Load the EPM annotations for all properties independent of their kind in order to fail on invalid property kinds.
model.LoadEpmAnnotations(property, mappings, entityTypeName, property);
}
}
// Set the new EPM annotation on the entity type only at the very end to not leave a
// inconsistent annotation if building it fails.
model.SetAnnotationValue(entityType, mappings);
}
示例2: LoadEpmAnnotations
private static void LoadEpmAnnotations(IEdmModel model, IEdmEntityType entityType)
{
string typeName = entityType.ODataFullName();
ODataEntityPropertyMappingCollection mappings = new ODataEntityPropertyMappingCollection();
model.LoadEpmAnnotations(entityType, mappings, typeName, null);
IEnumerable<IEdmProperty> declaredProperties = entityType.DeclaredProperties;
if (declaredProperties != null)
{
foreach (IEdmProperty property in declaredProperties)
{
model.LoadEpmAnnotations(property, mappings, typeName, property);
}
}
model.SetAnnotationValue<ODataEntityPropertyMappingCollection>(entityType, mappings);
}