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


C# EdmEntityType.GetClrType方法代码示例

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


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

示例1: Can_get_and_set_clr_type_annotation

        public void Can_get_and_set_clr_type_annotation()
        {
            var entityType = new EdmEntityType();

            Assert.Null(entityType.GetClrType());

            entityType.SetClrType(typeof(object));

            Assert.Equal(typeof(object), entityType.GetClrType());
        }
开发者ID:WangWilliam,项目名称:EntityFramework5,代码行数:10,代码来源:EdmEntityTypeExtensionsTests.cs

示例2: Generate

        public void Generate(EdmEntityType entityType, DbDatabaseMapping databaseMapping)
        {
            //Contract.Requires(entityType != null);
            //Contract.Requires(databaseMapping != null);

            var entitySet = databaseMapping.Model.GetEntitySet(entityType);

            var entitySetMapping
                = databaseMapping.GetEntitySetMapping(entitySet)
                  ?? databaseMapping.AddEntitySetMapping(entitySet);

            var table
                = entitySetMapping.EntityTypeMappings.Any()
                      ? entitySetMapping.EntityTypeMappings.First().TypeMappingFragments.First().Table
                      : databaseMapping.Database.AddTable(entityType.GetRootType().Name);

            var entityTypeMappingFragment = new DbEntityTypeMappingFragment
                {
                    Table = table
                };

            var entityTypeMapping = new DbEntityTypeMapping
                {
                    EntityType = entityType,
                    IsHierarchyMapping = false
                };
            entityTypeMapping.TypeMappingFragments.Add(entityTypeMappingFragment);
            entityTypeMapping.SetClrType(entityType.GetClrType());

            entitySetMapping.EntityTypeMappings.Add(entityTypeMapping);

            new PropertyMappingGenerator(_providerManifest)
                .Generate(
                    entityType,
                    entityType.Properties,
                    entitySetMapping,
                    entityTypeMappingFragment,
                    new List<EdmProperty>(),
                    false);
        }
开发者ID:jimmy00784,项目名称:entityframework,代码行数:40,代码来源:EntityTypeMappingGenerator.cs

示例3: GetEntityTypeMappingInHierarchy

        protected static DbEntityTypeMapping GetEntityTypeMappingInHierarchy(
            DbDatabaseMapping databaseMapping, EdmEntityType entityType)
        {
            Contract.Requires(databaseMapping != null);
            Contract.Requires(entityType != null);

            var entityTypeMapping = databaseMapping.GetEntityTypeMapping(entityType);

            if (entityTypeMapping == null)
            {
                var entitySetMapping =
                    databaseMapping.GetEntitySetMapping(databaseMapping.Model.GetEntitySet(entityType));

                if (entitySetMapping != null)
                {
                    entityTypeMapping = entitySetMapping
                        .EntityTypeMappings
                        .First(
                            etm => entityType.DeclaredProperties.All(
                                dp => etm.TypeMappingFragments.First()
                                          .PropertyMappings.Select(pm => pm.PropertyPath.First()).Contains(dp)));
                }
            }

            if (entityTypeMapping == null)
            {
                throw Error.UnmappedAbstractType(entityType.GetClrType());
            }

            return entityTypeMapping;
        }
开发者ID:WangWilliam,项目名称:EntityFramework5,代码行数:31,代码来源:StructuralTypeMappingGenerator.cs

示例4: Configure

        internal void Configure(
            EdmEntityType entityType,
            DbDatabaseMapping databaseMapping,
            DbProviderManifest providerManifest)
        {
            Contract.Requires(entityType != null);
            Contract.Requires(databaseMapping != null);
            Contract.Requires(providerManifest != null);

            var entityTypeMapping
                = databaseMapping.GetEntityTypeMapping(entityType.GetClrType());

            if (entityTypeMapping != null)
            {
                VerifyAllCSpacePropertiesAreMapped(
                    databaseMapping.GetEntityTypeMappings(entityType),
                    entityTypeMapping.EntityType.DeclaredProperties,
                    new List<EdmProperty>());
            }

            ConfigurePropertyMappings(databaseMapping, entityType, providerManifest);
            ConfigureAssociationMappings(databaseMapping, entityType);
            ConfigureDependentKeys(databaseMapping);
        }
开发者ID:WangWilliam,项目名称:EntityFramework5,代码行数:24,代码来源:EntityTypeConfiguration.cs

示例5: ConfigureUnconfiguredType

 internal static void ConfigureUnconfiguredType(
     DbDatabaseMapping databaseMapping, DbProviderManifest providerManifest, EdmEntityType entityType)
 {
     var c = new EntityMappingConfiguration();
     var entityTypeMapping
         = databaseMapping.GetEntityTypeMapping(entityType.GetClrType());
     c.Configure(databaseMapping, providerManifest, entityType, ref entityTypeMapping, false, 0, 1);
 }
开发者ID:WangWilliam,项目名称:EntityFramework5,代码行数:8,代码来源:EntityTypeConfiguration.cs


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