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


C# EdmProperty.SetClrPropertyInfo方法代码示例

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


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

示例1: Can_configure_result_bindings

        public void Can_configure_result_bindings()
        {
            var modificationFunctionConfiguration = new ModificationFunctionConfiguration();

            var mockPropertyInfo = new MockPropertyInfo();

            modificationFunctionConfiguration
                .Result(new PropertyPath(mockPropertyInfo), "Foo");

            var entitySet = new EntitySet();
            entitySet.ChangeEntityContainerWithoutCollectionFixup(new EntityContainer("C", DataSpace.CSpace));

            var property = new EdmProperty("P1");
            property.SetClrPropertyInfo(mockPropertyInfo);

            var resultBinding = new StorageModificationFunctionResultBinding("Bar", property);

            modificationFunctionConfiguration.Configure(
                new StorageModificationFunctionMapping(
                    entitySet,
                    new EntityType("E", "N", DataSpace.CSpace),
                    new EdmFunction("F", "N", DataSpace.SSpace),
                    new[]
                        {
                            new StorageModificationFunctionParameterBinding(
                                new FunctionParameter(
                                "P",
                                TypeUsage.Create(
                                    PrimitiveType.GetEdmPrimitiveType(PrimitiveTypeKind.String)),
                                ParameterMode.In),
                                new StorageModificationFunctionMemberPath(new[] { property }, null), false)
                        },
                    null,
                    new[] { resultBinding }));

            Assert.Equal("Foo", resultBinding.ColumnName);
        }
开发者ID:christiandpena,项目名称:entityframework,代码行数:37,代码来源:ModificationFunctionConfigurationTests.cs

示例2: Configure_should_ensure_consistency_of_constraint_when_already_configured

        public void Configure_should_ensure_consistency_of_constraint_when_already_configured()
        {
            var associationType = new AssociationType("A", XmlConstants.ModelNamespace_3, false, DataSpace.CSpace);
            associationType.SourceEnd = new AssociationEndMember("S", new EntityType("SE", "N", DataSpace.CSpace));

            var targetEntityType = new EntityType("TE", "N", DataSpace.CSpace);
            var propertyInfo = new MockPropertyInfo(typeof(int), "P2").Object;
            var property = new EdmProperty("P2", TypeUsage.Create(PrimitiveType.GetEdmPrimitiveType(PrimitiveTypeKind.Int32)));
            targetEntityType.AddMember(property);
            property.SetClrPropertyInfo(propertyInfo);

            associationType.TargetEnd = new AssociationEndMember("T", targetEntityType);
            var navigationPropertyConfigurationA
                = new NavigationPropertyConfiguration(new MockPropertyInfo(typeof(AType1), "N1"));
            associationType.SetConfiguration(navigationPropertyConfigurationA);
            var constraint = new ForeignKeyConstraintConfiguration(
                new[]
                {
                    propertyInfo
                });
            var navigationPropertyConfigurationB
                = new NavigationPropertyConfiguration(new MockPropertyInfo(typeof(AType1), "N2"))
                {
                    Constraint = constraint
                };

            navigationPropertyConfigurationB.Configure(
                new NavigationProperty("N", TypeUsage.Create(associationType.TargetEnd.GetEntityType()))
                {
                    RelationshipType = associationType
                },
                new EdmModel(DataSpace.CSpace), new EntityTypeConfiguration(typeof(object)));

            Assert.Equal(constraint, navigationPropertyConfigurationA.Constraint);
        }
开发者ID:Cireson,项目名称:EntityFramework6,代码行数:35,代码来源:NavigationPropertyConfigurationTests.cs


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