当前位置: 首页>>代码示例>>C#>>正文


C# IEdmModel.LoadEpmAnnotations方法代码示例

本文整理汇总了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);
        }
开发者ID:smasonuk,项目名称:odata-sparql,代码行数:30,代码来源:EpmExtensionMethods.cs

示例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);
 }
开发者ID:nickchal,项目名称:pash,代码行数:15,代码来源:EpmExtensionMethods.cs


注:本文中的IEdmModel.LoadEpmAnnotations方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。