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


C# StorageEntityContainerMapping类代码示例

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


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

示例1: WriteEntityContainerMappingElement

        // internal for testing
        internal void WriteEntityContainerMappingElement(StorageEntityContainerMapping containerMapping)
        {
            DebugCheck.NotNull(containerMapping);

            _xmlWriter.WriteStartElement(StorageMslConstructs.EntityContainerMappingElement);
            _xmlWriter.WriteAttributeString(StorageMslConstructs.StorageEntityContainerAttribute, _dbSchemaName);
            _xmlWriter.WriteAttributeString(
                StorageMslConstructs.CdmEntityContainerAttribute, containerMapping.EdmEntityContainer.Name);

            foreach (var set in containerMapping.EntitySetMappings)
            {
                WriteEntitySetMappingElement(set);
            }

            foreach (var set in containerMapping.AssociationSetMappings)
            {
                WriteAssociationSetMappingElement(set);
            }

            foreach (var functionMapping in containerMapping.FunctionImportMappings.OfType<FunctionImportMappingComposable>())
            {
                WriteFunctionImportMappingElement(functionMapping);
            }

            _xmlWriter.WriteEndElement();
        }
开发者ID:hallco978,项目名称:entityframework,代码行数:27,代码来源:MslXmlSchemaWriter.cs

示例2: StorageEntitySetMapping

        /// <summary>
        ///     Construct a EntitySet mapping object
        /// </summary>
        /// <param name="extent"> EntitySet metadata object </param>
        /// <param name="entityContainerMapping"> The entity Container Mapping that contains this Set mapping </param>
        public StorageEntitySetMapping(EntitySet extent, StorageEntityContainerMapping entityContainerMapping)
            : base(extent, entityContainerMapping)
        {
            Check.NotNull(extent, "extent");

            m_modificationFunctionMappings = new List<StorageEntityTypeModificationFunctionMapping>();
            m_implicitlyMappedAssociationSetEnds = new List<AssociationSetEnd>();
        }
开发者ID:hallco978,项目名称:entityframework,代码行数:13,代码来源:StorageEntitySetMapping.cs

示例3: Can_get_entity_set

        public void Can_get_entity_set()
        {
            var entityContainerMapping = new StorageEntityContainerMapping(new EntityContainer("C", DataSpace.CSpace));
            var entitySet = new EntitySet();
            var entitySetMapping = new StorageEntitySetMapping(entitySet, entityContainerMapping);

            Assert.Same(entitySet, entitySetMapping.EntitySet);
        }
开发者ID:christiandpena,项目名称:entityframework,代码行数:8,代码来源:StorageEntitySetMappingTests.cs

示例4: Visit

 protected virtual void Visit(StorageEntityContainerMapping storageEntityContainerMapping)
 {
     Visit(storageEntityContainerMapping.EdmEntityContainer);
     Visit(storageEntityContainerMapping.StorageEntityContainer);
     foreach (var mapping in storageEntityContainerMapping.EntitySetMaps)
     {
         Visit(mapping);
     }
 }
开发者ID:WangWilliam,项目名称:EntityFramework5,代码行数:9,代码来源:basemetadatamappingvisitor.cs

示例5: Can_get_store_and_entity_containers

        public void Can_get_store_and_entity_containers()
        {
            var entityContainer = new EntityContainer("C", DataSpace.CSpace);
            var storeContainer = new EntityContainer("S", DataSpace.CSpace);
            var entityContainerMapping = 
                new StorageEntityContainerMapping(entityContainer, storeContainer, null, false, false);

            Assert.Same(entityContainer, entityContainerMapping.EdmEntityContainer);
            Assert.Same(storeContainer, entityContainerMapping.StorageEntityContainer);
        }
开发者ID:christiandpena,项目名称:entityframework,代码行数:10,代码来源:StorageEntityContainerMappingTests.cs

示例6: Can_get_container_mapping

        public void Can_get_container_mapping()
        {
            var containerMapping = new StorageEntityContainerMapping(new EntityContainer("C", DataSpace.CSpace));
            var storageSetMapping
                = new StorageEntitySetMapping(
                    new EntitySet(),
                    containerMapping);

            Assert.Same(containerMapping, storageSetMapping.EntityContainerMapping);
        }
开发者ID:christiandpena,项目名称:entityframework,代码行数:10,代码来源:StorageSetMappingTests.cs

示例7: Can_add_container_mappings

        public void Can_add_container_mappings()
        {
            var mapping = new DbDatabaseMapping();

            Assert.Empty(mapping.EntityContainerMappings);

            var containerMapping = new StorageEntityContainerMapping(new EntityContainer());
            mapping.AddEntityContainerMapping(containerMapping);

            Assert.Same(containerMapping, mapping.EntityContainerMappings.Single());
        }
开发者ID:christiandpena,项目名称:entityframework,代码行数:11,代码来源:DbDatabaseMappingTests.cs

示例8: GenerateViewsFromMapping

        /// <summary>
        ///     Entry point for View Generation
        /// </summary>
        /// <param name="containerMapping"> </param>
        /// <param name="workSpace"> </param>
        /// <param name="config"> </param>
        /// <returns> Generated Views for EntitySets </returns>
        internal static ViewGenResults GenerateViewsFromMapping(StorageEntityContainerMapping containerMapping, ConfigViewGenerator config)
        {
            DebugCheck.NotNull(containerMapping);
            DebugCheck.NotNull(config);
            Debug.Assert(containerMapping.HasViews, "Precondition Violated: No mapping exists to generate views for!");

            //Create Cells from StorageEntityContainerMapping
            var cellCreator = new CellCreator(containerMapping);
            var cells = cellCreator.GenerateCells();
            var identifiers = cellCreator.Identifiers;

            return GenerateViewsFromCells(cells, config, identifiers, containerMapping);
        }
开发者ID:christiandpena,项目名称:entityframework,代码行数:20,代码来源:ViewgenGatekeeper.cs

示例9: Can_get_entity_type_mappings

        public void Can_get_entity_type_mappings()
        {
            var entityContainerMapping = new StorageEntityContainerMapping(new EntityContainer("C", DataSpace.CSpace));
            var entitySetMapping = new StorageEntitySetMapping(new EntitySet(), entityContainerMapping);

            Assert.Empty(entitySetMapping.EntityTypeMappings);

            var entityTypeMapping
                = new StorageEntityTypeMapping(
                    new StorageEntitySetMapping(new EntitySet(), entityContainerMapping));

            entitySetMapping.AddTypeMapping(entityTypeMapping);

            Assert.Same(entityTypeMapping, entitySetMapping.EntityTypeMappings.Single());
        }
开发者ID:christiandpena,项目名称:entityframework,代码行数:15,代码来源:StorageEntitySetMappingTests.cs

示例10: ViewGenerator

        // effects: Creates a ViewGenerator object that is capable of
        // producing query or update mapping views given the relevant schema
        // given the "cells"
        internal ViewGenerator(
            CellGroup cellGroup, ConfigViewGenerator config,
            List<ForeignConstraint> foreignKeyConstraints,
            StorageEntityContainerMapping entityContainerMapping)
        {
            m_cellGroup = cellGroup;
            m_config = config;
            m_queryRewriterCache = new Dictionary<EntitySetBase, QueryRewriter>();
            m_foreignKeyConstraints = foreignKeyConstraints;
            m_entityContainerMapping = entityContainerMapping;

            var inheritanceGraph =
                MetadataHelper.BuildUndirectedGraphOfTypes(entityContainerMapping.StorageMappingItemCollection.EdmItemCollection);
            SetConfiguration(entityContainerMapping);

            // We fix all the cells at this point
            m_queryDomainMap = new MemberDomainMap(
                ViewTarget.QueryView, m_config.IsValidationEnabled, cellGroup,
                entityContainerMapping.StorageMappingItemCollection.EdmItemCollection, m_config, inheritanceGraph);
            m_updateDomainMap = new MemberDomainMap(
                ViewTarget.UpdateView, m_config.IsValidationEnabled, cellGroup,
                entityContainerMapping.StorageMappingItemCollection.EdmItemCollection, m_config, inheritanceGraph);

            // We now go and fix the queryDomain map so that it has all the
            // values from the S-side as well -- this is needed for domain
            // constraint propagation, i.e., values from the S-side get
            // propagated to te oneOfConst on the C-side. So we better get
            // the "possiblveValues" stuff to contain those constants as well
            MemberDomainMap.PropagateUpdateDomainToQueryDomain(cellGroup, m_queryDomainMap, m_updateDomainMap);

            UpdateWhereClauseForEachCell(cellGroup, m_queryDomainMap, m_updateDomainMap, m_config);

            // We need to simplify cell queries, yet we don't want the conditions to disappear
            // So, add an extra value to the domain, temporarily
            var queryOpenDomain = m_queryDomainMap.GetOpenDomain();
            var updateOpenDomain = m_updateDomainMap.GetOpenDomain();

            // Make sure the WHERE clauses of the cells reflect the changes
            foreach (var cell in cellGroup)
            {
                cell.CQuery.WhereClause.FixDomainMap(queryOpenDomain);
                cell.SQuery.WhereClause.FixDomainMap(updateOpenDomain);
                cell.CQuery.WhereClause.ExpensiveSimplify();
                cell.SQuery.WhereClause.ExpensiveSimplify();
                cell.CQuery.WhereClause.FixDomainMap(m_queryDomainMap);
                cell.SQuery.WhereClause.FixDomainMap(m_updateDomainMap);
            }
        }
开发者ID:junxy,项目名称:entityframework,代码行数:51,代码来源:ViewGenerator.cs

示例11: Can_get_association_set_mappings

        public void Can_get_association_set_mappings()
        {
            var entityContainerMapping = new StorageEntityContainerMapping(new EntityContainer("C", DataSpace.CSpace));

            Assert.Empty(entityContainerMapping.AssociationSetMappings);
            Assert.Empty(entityContainerMapping.RelationshipSetMaps);

            var associationSetMapping
                = new StorageAssociationSetMapping(
                    new AssociationSet("AS", new AssociationType("A", XmlConstants.ModelNamespace_3, false, DataSpace.CSpace)), entityContainerMapping);

            entityContainerMapping.AddAssociationSetMapping(associationSetMapping);

            Assert.Same(associationSetMapping, entityContainerMapping.AssociationSetMappings.Single());
            Assert.Same(associationSetMapping, entityContainerMapping.RelationshipSetMaps.Single());
        }
开发者ID:christiandpena,项目名称:entityframework,代码行数:16,代码来源:StorageEntityContainerMappingTests.cs

示例12: Can_get_entity_set_mappings

        public void Can_get_entity_set_mappings()
        {
            var entityContainerMapping = new StorageEntityContainerMapping(new EntityContainer("C", DataSpace.CSpace));

            Assert.Empty(entityContainerMapping.EntitySetMappings);
            Assert.Empty(entityContainerMapping.EntitySetMaps);

            var entitySetMapping
                = new StorageEntitySetMapping(
                    new EntitySet("ES", null, null, null, new EntityType("E", "N", DataSpace.CSpace)), entityContainerMapping);

            entityContainerMapping.AddEntitySetMapping(entitySetMapping);

            Assert.Same(entitySetMapping, entityContainerMapping.EntitySetMappings.Single());
            Assert.Same(entitySetMapping, entityContainerMapping.EntitySetMaps.Single());
        }
开发者ID:christiandpena,项目名称:entityframework,代码行数:16,代码来源:StorageEntityContainerMappingTests.cs

示例13: Can_add_and_get_function_import_mapping

        public void Can_add_and_get_function_import_mapping()
        {
            var typeUsage = 
                TypeUsage.CreateDefaultTypeUsage(
                    PrimitiveType.GetEdmPrimitiveType(PrimitiveTypeKind.Int32).GetCollectionType());

            var entityContainerMapping = new StorageEntityContainerMapping(new EntityContainer("C", DataSpace.CSpace));

            var composableFuntionMapping =
                new FunctionImportMappingComposable(
                    new EdmFunction(
                        "f", "model", DataSpace.CSpace,
                        new EdmFunctionPayload()
                            {
                                IsComposable = true,
                                ReturnParameters =
                                    new[]
                                        {
                                            new FunctionParameter(
                                                "ReturnType",
                                                typeUsage,
                                                ParameterMode.ReturnValue),
                                        }

                            }),
                    new EdmFunction(
                        "f", "store", DataSpace.SSpace,
                        new EdmFunctionPayload()
                            {
                                IsComposable = true,
                                ReturnParameters =
                                    new[]
                                        {
                                            new FunctionParameter(
                                                "ReturnType",
                                                typeUsage,
                                                ParameterMode.ReturnValue),
                                        }
                            }),
                    null);

            Assert.Empty(entityContainerMapping.FunctionImportMappings);
            entityContainerMapping.AddFunctionImportMapping(composableFuntionMapping);
            Assert.Same(composableFuntionMapping, entityContainerMapping.FunctionImportMappings.Single());
        }
开发者ID:christiandpena,项目名称:entityframework,代码行数:45,代码来源:StorageEntityContainerMappingTests.cs

示例14: GenerateViewsFromMapping

        /// <summary>
        /// Entry point for View Generation
        /// </summary>
        /// <param name="containerMapping"></param>
        /// <param name="workSpace"></param>
        /// <param name="config"></param>
        /// <returns>Generated Views for EntitySets</returns>
        internal static ViewGenResults GenerateViewsFromMapping(StorageEntityContainerMapping containerMapping, ConfigViewGenerator config)
        {
            EntityUtil.CheckArgumentNull(containerMapping, "containerMapping");
            EntityUtil.CheckArgumentNull(config, "config");
            Debug.Assert(containerMapping.HasViews, "Precondition Violated: No mapping exists to generate views for!");

            if (config.IsNormalTracing)
            {
                containerMapping.Print(0);
            }

            //Create Cells from StorageEntityContainerMapping
            CellCreator cellCreator = new CellCreator(containerMapping);
            List<Cell> cells = cellCreator.GenerateCells(config);
            CqlIdentifiers identifiers = cellCreator.Identifiers;

            return GenerateViewsFromCells(cells, config, identifiers, containerMapping);
        }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:25,代码来源:ViewgenGatekeeper.cs

示例15: GenerateViewsFromMapping

        /// <summary>
        /// Entry point for View Generation
        /// </summary>
        /// <param name="containerMapping"></param>
        /// <param name="workSpace"></param>
        /// <param name="config"></param>
        /// <returns>Generated Views for EntitySets</returns>
        internal static ViewGenResults GenerateViewsFromMapping(StorageEntityContainerMapping containerMapping, ConfigViewGenerator config)
        {
            //Contract.Requires(containerMapping != null);
            //Contract.Requires(config != null);
            Debug.Assert(containerMapping.HasViews, "Precondition Violated: No mapping exists to generate views for!");

#if DEBUG
            if (config.IsNormalTracing)
            {
                containerMapping.Print(0);
            }
#endif

            //Create Cells from StorageEntityContainerMapping
            var cellCreator = new CellCreator(containerMapping);
            var cells = cellCreator.GenerateCells();
            var identifiers = cellCreator.Identifiers;

            return GenerateViewsFromCells(cells, config, identifiers, containerMapping);
        }
开发者ID:jimmy00784,项目名称:entityframework,代码行数:27,代码来源:ViewgenGatekeeper.cs


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