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


C# IEdmModel.EnsureEpmCache方法代码示例

本文整理汇总了C#中IEdmModel.EnsureEpmCache方法的典型用法代码示例。如果您正苦于以下问题:C# IEdmModel.EnsureEpmCache方法的具体用法?C# IEdmModel.EnsureEpmCache怎么用?C# IEdmModel.EnsureEpmCache使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IEdmModel的用法示例。


在下文中一共展示了IEdmModel.EnsureEpmCache方法的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);
                        }
                    }
                }
            }
        }
开发者ID:smasonuk,项目名称:odata-sparql,代码行数:39,代码来源:ODataUtils.cs

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


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