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


C# ComplexType.GetMetadataProperties方法代码示例

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


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

示例1: GetClrType_returns_CLR_type_annotation_for_ComplexType

        public void GetClrType_returns_CLR_type_annotation_for_ComplexType()
        {
            var complexType = new ComplexType("C", "N", DataSpace.CSpace);

            Assert.Null(((EdmType)complexType).GetClrType());

            complexType.GetMetadataProperties().SetClrType(typeof(Random));

            Assert.Same(typeof(Random), ((EdmType)complexType).GetClrType());
        }
开发者ID:Cireson,项目名称:EntityFramework6,代码行数:10,代码来源:EdmTypeExtensionsTests.cs

示例2: Should_be_able_to_get_and_set_clr_type

        public void Should_be_able_to_get_and_set_clr_type()
        {
            var complexType = new ComplexType("C");

            Assert.Null(complexType.GetClrType());

            var type = typeof(object);

            complexType.GetMetadataProperties().SetClrType(type);

            Assert.Equal(typeof(object), complexType.GetClrType());
        }
开发者ID:Cireson,项目名称:EntityFramework6,代码行数:12,代码来源:ComplexTypeExtensionsTests.cs

示例3: GetComplexParameterBindings_should_return_all_complex_parameter_bindings_for_type

        public void GetComplexParameterBindings_should_return_all_complex_parameter_bindings_for_type()
        {
            var databaseMapping
                = new DbDatabaseMapping()
                    .Initialize(
                        new EdmModel(DataSpace.CSpace),
                        new EdmModel(DataSpace.SSpace));

            var entityType = new EntityType("E", "N", DataSpace.CSpace);
            var entitySet = databaseMapping.Model.AddEntitySet("ES", entityType);
            var entitySetMapping = databaseMapping.AddEntitySetMapping(entitySet);

            var complexType1 = new ComplexType();
            complexType1.GetMetadataProperties().SetClrType(typeof(string));

            var complexType2 = new ComplexType();
            complexType2.GetMetadataProperties().SetClrType(typeof(object));

            var storageModificationFunctionMapping
                = new ModificationFunctionMapping(
                    entitySet,
                    entityType,
                    new EdmFunction("F", "N", DataSpace.SSpace),
                    new[]
                        {
                            new ModificationFunctionParameterBinding(
                                new FunctionParameter(),
                                new ModificationFunctionMemberPath(
                                new EdmMember[]
                                    {
                                        EdmProperty.CreateComplex("C1", complexType1),
                                        EdmProperty.CreateComplex("C2", complexType2),
                                        new EdmProperty("M")
                                    },
                                null),
                                true
                                )
                        },
                    null,
                    null);

            entitySetMapping.AddModificationFunctionMapping(
                new EntityTypeModificationFunctionMapping(
                    entityType,
                    storageModificationFunctionMapping,
                    storageModificationFunctionMapping,
                    storageModificationFunctionMapping));

            Assert.Equal(3, databaseMapping.GetComplexParameterBindings(typeof(string)).Count());
            Assert.Equal(3, databaseMapping.GetComplexParameterBindings(typeof(object)).Count());
        }
开发者ID:Cireson,项目名称:EntityFramework6,代码行数:51,代码来源:DbDatabaseMappingExtensionsTests.cs

示例4: GetComplexPropertyMappings_should_return_all_complex_property_mappings_for_type

        public void GetComplexPropertyMappings_should_return_all_complex_property_mappings_for_type()
        {
            var databaseMapping = new DbDatabaseMapping()
                .Initialize(new EdmModel(DataSpace.CSpace), new EdmModel(DataSpace.SSpace));
            var entitySet = new EntitySet
                                {
                                    Name = "ES"
                                };
            var entitySetMapping = databaseMapping.AddEntitySetMapping(entitySet);
            var entityTypeMapping = new EntityTypeMapping(null);
            entitySetMapping.AddTypeMapping(entityTypeMapping);
            var entityTypeMappingFragment = new MappingFragment(entitySet, entityTypeMapping, false);
            entityTypeMapping.AddFragment(entityTypeMappingFragment);
            var complexType = new ComplexType("C");
            var propertyMapping1
                = new ColumnMappingBuilder(
                    new EdmProperty("C", TypeUsage.Create(new PrimitiveType() { DataSpace = DataSpace.SSpace })),
                    new[]
                        {
                            EdmProperty.CreateComplex("P1", complexType),
                            EdmProperty.CreatePrimitive("P", PrimitiveType.GetEdmPrimitiveType(PrimitiveTypeKind.String))
                        });
            var type = typeof(object);

            complexType.GetMetadataProperties().SetClrType(type);

            entityTypeMappingFragment.AddColumnMapping(propertyMapping1);

            var propertyMapping2
                = new ColumnMappingBuilder(
                    new EdmProperty("C", TypeUsage.Create(new PrimitiveType() { DataSpace = DataSpace.SSpace })),
                    new List<EdmProperty>
                        {
                            EdmProperty.CreateComplex("P3", complexType),
                            EdmProperty.CreatePrimitive(
                                "P2", PrimitiveType.GetEdmPrimitiveType(PrimitiveTypeKind.String)),
                        });
            entityTypeMappingFragment.AddColumnMapping(propertyMapping2);

            Assert.Equal(2, databaseMapping.GetComplexPropertyMappings(typeof(object)).Count());
        }
开发者ID:Cireson,项目名称:EntityFramework6,代码行数:41,代码来源:DbDatabaseMappingExtensionsTests.cs

示例5: Configure

 internal virtual void Configure(ComplexType complexType)
 {
     Configure(complexType.Name, complexType.Properties, complexType.GetMetadataProperties());
 }
开发者ID:Cireson,项目名称:EntityFramework6,代码行数:4,代码来源:ComplexTypeConfiguration.cs


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