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


C# StorageEntityContainerMapping.HasMappingFragments方法代码示例

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


在下文中一共展示了StorageEntityContainerMapping.HasMappingFragments方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GenerateEntitySetViews

        internal static void GenerateEntitySetViews(
            StorageEntityContainerMapping entityContainerMapping, 
            Dictionary<EntitySetBase, string> esqlViews,
            IList<EdmSchemaError> errors)
        {
            Debug.Assert(entityContainerMapping.HasViews);

            // If entityContainerMapping contains only query views, then add a warning to the errors and continue to next mapping.
            if (!entityContainerMapping.HasMappingFragments())
            {
                Debug.Assert(
                    2088 == (int)StorageMappingErrorCode.MappingAllQueryViewAtCompileTime,
                    "Please change the ERRORCODE_MAPPINGALLQUERYVIEWATCOMPILETIME value as well");
                errors.Add(
                    new EdmSchemaError(
                        Strings.Mapping_AllQueryViewAtCompileTime(entityContainerMapping.Identity),
                        (int)StorageMappingErrorCode.MappingAllQueryViewAtCompileTime,
                        EdmSchemaErrorSeverity.Warning));
            }
            else
            {
                var viewGenResults = ViewgenGatekeeper.GenerateViewsFromMapping(
                    entityContainerMapping, new ConfigViewGenerator
                    {
                        GenerateEsql = true
                    });
                if (viewGenResults.HasErrors)
                {
                    ((List<EdmSchemaError>)errors).AddRange(viewGenResults.Errors);
                }
                var extentMappingViews = viewGenResults.Views;
                foreach (var extentViewPair in extentMappingViews.KeyValuePairs)
                {
                    var generatedViews = extentViewPair.Value;
                    // Multiple Views are returned for an extent but the first view
                    // is the only one that we will use for now. In the future,
                    // we might start using the other views which are per type within an extent.
                    esqlViews.Add(extentViewPair.Key, generatedViews[0].eSQL);
                }
            }
        }
开发者ID:christiandpena,项目名称:entityframework,代码行数:41,代码来源:StorageMappingItemCollection.cs

示例2: GenerateViews

        internal static Dictionary<EntitySetBase, DbMappingView> GenerateViews(
            StorageEntityContainerMapping containerMapping, IList<EdmSchemaError> errors)
        {
            var views = new Dictionary<EntitySetBase, DbMappingView>();

            if (!containerMapping.HasViews)
            {
                return views;
            }

            // If the entity container mapping has only query views, add a warning and return.
            if (!containerMapping.HasMappingFragments())
            {
                Debug.Assert(
                    2088 == (int)StorageMappingErrorCode.MappingAllQueryViewAtCompileTime,
                    "Please change the ERRORCODE_MAPPINGALLQUERYVIEWATCOMPILETIME value as well.");

                errors.Add(
                    new EdmSchemaError(
                        Strings.Mapping_AllQueryViewAtCompileTime(containerMapping.Identity),
                        (int)StorageMappingErrorCode.MappingAllQueryViewAtCompileTime,
                        EdmSchemaErrorSeverity.Warning));

                return views;
            }

            var viewGenResults = ViewgenGatekeeper.GenerateViewsFromMapping(
                containerMapping, new ConfigViewGenerator { GenerateEsql = true });

            if (viewGenResults.HasErrors)
            {
                viewGenResults.Errors.Each(e => errors.Add(e));
            }

            foreach (var extentViewPair in viewGenResults.Views.KeyValuePairs)
            {
                // Multiple views are returned for an extent but the first view is 
                // the only one that we will use for now. In the future, we might 
                // start using the other views which are per type within an extent.
                views.Add(extentViewPair.Key, new DbMappingView(extentViewPair.Value[0].eSQL));
            }

            return views;
        }
开发者ID:hallco978,项目名称:entityframework,代码行数:44,代码来源:StorageMappingItemCollection.cs


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